前端新人小白求助!!!js总是报错:not of type 'Node'!!!

JavaScript017

前端新人小白求助!!!js总是报错:not of type 'Node'!!!,第1张

oOtionl.removeChild('oOtionl_div[i]')这句错了 'oOtionl_div[i]' 是个字串 不是一个node (节点对象) 所以 不能作为 removeChild的参数使用 把参数的引号去掉 改成oOtionl.removeChild(oOtionl_div[i])试一下

if (typeof(document.onselectstart) != "undefined") {       

    // IE下禁止元素被选取       

    document.onselectstart = function (event){

        if(event.target.tagName!="INPUT"){

            return false

        }

    }      

} else {

    // firefox下禁止元素被选取的变通办法       

    document.onmousedown = function (event){

        if(event.target.tagName!="INPUT"){

            return false

        }

    }      

    document.onmouseup = function(event){

        if(event.target.tagName!="INPUT"){

            return false

        }

    }       

}