最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
dom增加,删除,节点实例教程
时间:2008-07-18 编辑:简简单单 来源:一聚教程网
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);
-
上一个: WEB标准是什么?
-
下一个: js setInterval函数实现教程
相关文章
- Dom 删除表格行列实例 01-07
- HTML简单购物数量小程序代码展示 10-31
- html canvas实现弹幕功能 10-31
- HTML中空格表示的意义 10-31
- html area标签解读 10-31
- html使用表单标签实现注册页面代码展示 10-31