嗨我想了解如何使DOM elemnt,让我们说“div”形式我的数据对象。 我做了这样一个对象:从javascript中创建DOM元素
var div = {
style : {
width: Math.floor(Math.random() * 100),
height: Math.floor(Math.random() * 100),
position: "relative",
top:Math.floor(Math.random()*500)
},
sayHi: function() {
alert("Hello");
},
}
我现在需要做的,就是与这些CSS PARAMS,使其生活元素DOM? 谢谢
或者如果您想要多个单击事件,请使用自定义事件处理程序。使用jQuery™。 –
谢谢,它可行! – Karb
*“'var DOMdiv = document.create(”div“);'”*应该是'createElement',而不仅仅是'create'。 –