var Fathert = document.getElementById("div2");//
var obj = document.createElement("div");
obj.id = divID;
obj.style.border = "1px solid #9AFF02";
obj.style.height = 10+ "px";
obj.style.width = 10+ "px";
obj.style.cursor = "hand";
obj.setAttribute("name", divname);
obj.style.backgroundColor = "transparent";
obj.algin = "center";
<pre name="code" class="javascript">Fathert .appendChild(obj);//添加到什么元素的上面
JS动态生成DIV
JS动态生成DIV
最新推荐文章于 2021-06-04 15:32:46 发布