i use attachEvent to bind a event ;
code:
img.attachEvent("onclick",alert("aa"));
div.appendChild(img);
div.innerHTML+="some text";
the event can not work; why can't i use it?
if i use nether code , it can work;
code:
img.attachEvent("onclick",alert("aa"));
div.appendChild(img);
spanWord = document.createElement("span");
spanWord.innerHTML="some text";
div.appendChild(spanWord);
do anybody know the reason?