var DIV = document.createElement("div");
DIV.style.position = "absolute";
DIV.style.width = "20px";
DIV.style.height = "20px"
DIV.style.left = "0";
DIV.style.top = "0";
DIV.style.cursor = "move";
DIV.onmousedown="alert(\"1\");"; //这里不知道该怎么写?
DIV.innerHTML = "<img src="+obj+">";
document.getElementById("photocontent").appendChild(DIV);上面是动态添加一个div元素,style会设置,但想在div上面加onmousedown事件那样写就没反应,不知道应该怎么写?
DIV.style.position = "absolute";
DIV.style.width = "20px";
DIV.style.height = "20px"
DIV.style.left = "0";
DIV.style.top = "0";
DIV.style.cursor = "move";
DIV.onmousedown="alert(\"1\");"; //这里不知道该怎么写?
DIV.innerHTML = "<img src="+obj+">";
document.getElementById("photocontent").appendChild(DIV);上面是动态添加一个div元素,style会设置,但想在div上面加onmousedown事件那样写就没反应,不知道应该怎么写?
http://topic.csdn.net/u/20090121/22/dec0472b-a17f-44aa-a1ca-1a323fe04cc1.html
来接分吧