J
Jeff Thies
I think I am misundertanding how "in" works.
I thought I could do this:
var div_array=document.getElementsByTagName('div');
for(var el in div_array){
// I thought el would be an element of that array
// doing this: alert(el) yields either the elements ID or "length"
// why is that?
}
This works, which I thought was the same.
for(var i=0; i< div_array.length; i++){
var el=div_array;
alert(el.innerHTML);
}
Cheers,
Jeff
I thought I could do this:
var div_array=document.getElementsByTagName('div');
for(var el in div_array){
// I thought el would be an element of that array
// doing this: alert(el) yields either the elements ID or "length"
// why is that?
}
This works, which I thought was the same.
for(var i=0; i< div_array.length; i++){
var el=div_array;
alert(el.innerHTML);
}
Cheers,
Jeff