J
Jeff Thies
I have this:
<div id="a">
a
</div>
<div id="b">
b
</div>
<script type="text/javascript">
var X = new Object();
var a = document.getElementById('a');
var b = document.getElementById('b');
X[a] = 'A';
if(X[a]){alert('object a')} // I get the expected alert
if(X){alert('object b')} // There is no X defined but I still get
an alert. Why?
</script>
I'm initializing an instance for various objects on a page and I want to
keep track of them. How do I do that?
Jeff
<div id="a">
a
</div>
<div id="b">
b
</div>
<script type="text/javascript">
var X = new Object();
var a = document.getElementById('a');
var b = document.getElementById('b');
X[a] = 'A';
if(X[a]){alert('object a')} // I get the expected alert
if(X){alert('object b')} // There is no X defined but I still get
an alert. Why?
</script>
I'm initializing an instance for various objects on a page and I want to
keep track of them. How do I do that?
Jeff