S
SkyZhao
if i use AttachEvent like this,it can't work;
eg:
var img = document.createElement("img");
img.appendChild("onclick",alert("test"));
var div = document.createElement("div");
div.appendChild(img); //can't work;
div.innerHTML="<-click this";
but i use attachEvent like this,it work;
eg:
var img = document.createElement("img");
img.appendChild("onclick",alert("test"));
var text = document.createElement("span");
text.innerHTML="<-click this";
var div = documet.createElement("div");
div.appendChild(img); //can work
div.appendChild(text);
eg:
var img = document.createElement("img");
img.appendChild("onclick",alert("test"));
var div = document.createElement("div");
div.appendChild(img); //can't work;
div.innerHTML="<-click this";
but i use attachEvent like this,it work;
eg:
var img = document.createElement("img");
img.appendChild("onclick",alert("test"));
var text = document.createElement("span");
text.innerHTML="<-click this";
var div = documet.createElement("div");
div.appendChild(img); //can work
div.appendChild(text);