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

解决方案 »

  1.   

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

  2.   


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

  3.   

    if (document.getElementById('addjs') != null) {//从你当前页面去找一个ID叫“addjs”的标签,判断是否存在,找到了就不为null,没找到就null
     document.body.removeChild(document.getElementById('addjs'));//移除该标签
     }
    document.getElementById('addjs')方法是根据ID来查找该标签
    还有种用名字来查找的document.getElementByName('addjs')