html 通过 js 动态添加div
展开全部
var com = document.createElement("div");
document.getElementById("XXXX").appendChild(com);
com.x = x;
com.y = y;
com.style.left = "XXpx";
com.style.top = "YYpx";
var txt = document.createElement("input");
txt.nodeType = "text";
com.appendChild(txt);
var btn = document.createElement("input");
btn.nodeType = "button";
btn.onclick = ConfirmComment();
com.appendChild(btn);
document.getElementById("XXXX").appendChild(com);
com.x = x;
com.y = y;
com.style.left = "XXpx";
com.style.top = "YYpx";
var txt = document.createElement("input");
txt.nodeType = "text";
com.appendChild(txt);
var btn = document.createElement("input");
btn.nodeType = "button";
btn.onclick = ConfirmComment();
com.appendChild(btn);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询