日期:2014-05-17  浏览次数:20738 次

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'));//从文档体中移除该标签
}