首页 > 360IE兼容模式下阻止默认点击事件的问题

360IE兼容模式下阻止默认点击事件的问题

//停止事件冒泡
function stopPropagation(event) {
    var e = event || window.event;
    if (e.stopPropagation)
        e.stopPropagation();
    e.cancelBubble = true;
}

//停止默认事件
function preventDefault(event) {
    var e = event || window.event;
    if (e.preventDefault)
        e.preventDefault();
    e.returnValue = false;
}


btn.on("click",function(event){

    stopPropagation(event);
    preventDefault(event);
    return false;//兼容所有浏览器

    //判断执行代码。。。

});

<a href="Vote.asp?id=<%=rs("id")%>" class="btn btn-tou" id='<%=rs("id")%>'>投票</a>

点击页面上的投票链接,为啥在360IE兼容模式下就是不执行,极速模式下可以


老的ie阻止默认事件写法:

returnValue = false;

阻止事件冒泡写法:

cancelBubble = true;
【热门文章】
【热门文章】