如何实现ie禁止返回功能和禁止用户用back space键返回页面(未测试)
function setBSkey() {
var blnEevntCancel = false ;
if (window.event && window.event.altKey && (window.event.keyCode == 8 || window.event.keyCode == 37 || window.event.keyCode == 39 )) {
blnEevntCancel = true ;
}
if ( window.event.keyCode == 8 ) {
if (window.event.srcElement.tagName.toUpperCase() == "TEXTAREA") {
if ( window.event.srcElement.readOnly == true ) {
blnEevntCancel = true ;
}
}
else if (window.event.srcElement.tagName.toUpperCase() == "INPUT" && event.srcElement.type.toUpperCase() == 'TEXT') {
if ( window.event.srcElement.readOnly == true ) {
blnEevntCancel = true ;
}
} else {
blnEevntCancel = true ;
}
}
if (blnEevntCancel == true ) {
window.event.cancelBubble = true;
window.event.returnValue = false;
return false;
}
}