标签:onkeydown highlight turn amp 后退 type class pst state
//禁用浏览器的backspace默认回退事件 document.onkeypress=function (e){ var ev = e || window.event;//获取event对象 var obj = ev.target || ev.srcElement;//获取事件源 var t = obj.type || obj.getAttribute(‘type‘);//获取事件源类型 if(ev.keyCode == 8 && t != "password" && t != "text" && t != "textarea" && t != "number"){ return false; } } document.onkeydown=function (e){ var ev = e || window.event;//获取event对象 var obj = ev.target || ev.srcElement;//获取事件源 var t = obj.type || obj.getAttribute(‘type‘);//获取事件源类型 if(ev.keyCode == 8 && t != "password" && t != "text" && t != "textarea" && t != "number"){ return false; } } var counter = 0; if (window.history && window.history.pushState) { $(window).on(‘popstate‘, function () { window.history.pushState(‘forward‘, null, ‘#‘); window.history.forward(1); }); } window.history.pushState(‘forward‘, null, ‘#‘); //在IE中必须得有这两行 window.history.forward(1);
标签:onkeydown highlight turn amp 后退 type class pst state
原文地址:https://www.cnblogs.com/Webyangbowen/p/9702362.html