最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
dom增加,删除,节点实例教程
时间:2022-07-02 13:49:02 编辑:袖梨 来源:一聚教程网
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);
相关文章
- 女神漫画免费阅读无限金币下载安装最新版本-女神漫画登录入口弹窗网站高清完整版 02-10
- 腾讯视频网页版入口在哪-腾讯视频网页版入口链接 02-10
- 歪歪漫画最新入口地址:2026年热门韩漫同步连载中 02-10
- 蛙漫2台版入口网页最新版-蛙漫2台版入口网页最新访问链接 02-10
- 创游世界网页版入口-创游世界网页版直达链接 02-10
- 12360火车票余票查询-如何在线查询火车票余票 02-10