JS通过ClassName禁止DIV点击
//通过ClassName获取div,使用setAttribute设置div禁止点击
var itemRoom= document.getElementsByClassName("page-wrapper"); for(var i = 0; i < itemRoom.length; i++){ itemRoom[i].setAttribute("style"," pointer-events:none;cursor: default;opacity: 0.6;"); }
pointer-events: none;是css3新出现的属性,意思就是禁止鼠标点击事件,当元素中有这一属性时,链接、点击事件统统失效