Hi Guys,
I'm trying to set an eventlistener for a bunch of DIV tags. can you tell me why this code wont work?
right now as soon as the page loads it triggers go() (which is a page redirect function)
I'm trying to set an eventlistener for a bunch of DIV tags. can you tell me why this code wont work?
Code:
display=document.getElementById("display");
field=display.getElementsByTagName('div');
for (var i in field){
if (field[i].addEventListener)
{
field[i].addEventListener('click',go(),false);
}
else if (field[i].attachEvent)
{
field[i].attachEvent('onclick',go());
}
Comment