读书人

javascribe之document的一些事,该怎么

发布时间: 2012-04-21 14:34:44 作者: rapoo

javascribe之document的一些事
if (document.getElementById('addjs') != null) {
document.body.removeChild(document.getElementById('addjs'));
}
本人菜鸟,向大家求教一下这是什么意思?

[解决办法]
if (document.getElementById('addjs') != null) {//如果存在该元素
document.body.removeChild(document.getElementById('addjs'));//删掉该元素
}

[解决办法]

JScript code
if (document.getElementById('addjs') != null) {//如果存在id=addjs标签    document.body.removeChild(document.getElementById('addjs'));//从文档体中移除该标签}
[解决办法]
if (document.getElementById('addjs') != null) {//从你当前页面去找一个ID叫“addjs”的标签,判断是否存在,找到了就不为null,没找到就null
document.body.removeChild(document.getElementById('addjs'));//移除该标签
}
document.getElementById('addjs')方法是根据ID来查找该标签
还有种用名字来查找的document.getElementByName('addjs')
[解决办法]
都对
探讨
JScript code

if (document.getElementById('addjs') != null) {//如果存在id=addjs标签
document.body.removeChild(document.getElementById('addjs'));//从文档体中移除该标签
}

读书人网 >Java Web开发

热点推荐