I don't get it:
That works.
That doesn't.
Can anyone tell me why I have to alert() the Objects in order to work with them?
Code:
var img_buttnz = document.getElementsByTagName('IMG'); for (var z = 0; z<img_buttnz.length; z++) { alert(img_buttnz[z].id); if(img_buttnz[z].id) { addEvent(img_buttnz[z], 'click', function() { k.changeFile(this); }); } }
Code:
var img_buttnz = document.getElementsByTagName('IMG'); for (var z = 0; z<img_buttnz.length; z++) { if(img_buttnz[z].id) { addEvent(img_buttnz[z], 'click', function() { k.changeFile(this); }); } }
Can anyone tell me why I have to alert() the Objects in order to work with them?
Comment