dom移除节点代码
// 设置关闭和确定按钮的功能--关闭(移除)提示框
btnEnter.onclick=aClose.onclick=function(){
document.body.removeChild(objId);
document.body.removeChild(shadow);
btnShow.disabled=false;
dom增加节点
document.body.appendChild(shadow);
obj.appendChild(divTitle);
obj.appendChild(Container);
obj.appendChild(msgBottom);
document.body.appendChild(obj);
例子:
var Btns=document.createElement("div");
Btns.setAttribute("id","btns");
var btnEnter=document.createElement("a");
btnEnter.setAttribute("id","btnEnter");
btnEnter.setAttribute("href","#1");
var txtEnter=document.createTextNode("确定");
btnEnter.appendChild(txtEnter);
Btns.appendChild(btnEnter);
js关闭层
var closeBar=document.createElement("div");
closeBar.setAttribute("id","closebar");
var A = document.createElement("a");
/*
以纯DOM的方法,我们这么写:
var txtCloseWindow=document.createTextNode("关闭窗口");
A.appendChild(txtCloseWindow);
*/
A.innerHTML="关闭窗口";
A.setAttribute("href","#1");
A.setAttribute("id","btnClose");
A.setAttribute("title","关闭窗口");
closeBar.appendChild(A);
2025年7月三大热门模因币:Arctic Pablo预售狂飙,1200美元变21.9万美元,与Dogwifhat和柴犬币齐名
英雄联盟手游梦魇什么时候出 梦魇上线时间一览
英雄没有闪火旋风流怎么玩 火旋风流技能装备搭配推荐
坚信「BTC 今年飙到 15 万美元」!Mike Novogratz:但 ETH 涨势会更猛
胜利女神新的希望竞技场怎么打 竞技场打法攻略
三国志幻想大陆2枭之歌吕布技能是什么 吕布技能介绍一览