yea i know there is millions of stuff about this on the net, and this isnt really a question but just wanted to see if people had picked up anything similar.
This is only for internet explorer, firefox doesnt have any problem.
so setAttribute for the onclick event works but not for Divs.
Anybody know why? Wouldnt this take extra coding to stop the function working?
this is the work around ive used anyway; after checking if the user is on IE:
god i hate IE.
This is only for internet explorer, firefox doesnt have any problem.
Code:
i = 666;
myImg = document.createElement("img");
myImg.setAttribute('onClick', 'doSomething(\'' +i+ '\');'); //this works
myDiv = document.createElement("div");
myDiv.setAttribute('onClick', 'doSomething(\'' +i+ '\');'); //this doesn't
so setAttribute for the onclick event works but not for Divs.
Anybody know why? Wouldnt this take extra coding to stop the function working?
this is the work around ive used anyway; after checking if the user is on IE:
Code:
myDiv.onclick = new Function( "return dosomething('" + i + "');" );
god i hate IE.
Comment