I think I am misundertanding how "in" works.
I thought I could do this:
var div_array=docum ent.getElements ByTagName('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.lengt h; i++){
var el=div_array[i];
alert(el.innerH TML);
}
Cheers,
Jeff
I thought I could do this:
var div_array=docum ent.getElements ByTagName('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.lengt h; i++){
var el=div_array[i];
alert(el.innerH TML);
}
Cheers,
Jeff
Comment