<Script Language=javascript>
function Click(){
if(document.addEventListener){
return false;
}
}
document.onselectstart = Click;
document.oncontextmenu = Click;
document.body.oncopy = Click;
document.onkeydown = = function(evt){
var evt=window.event?window.event:evt;
var a=evt.keyCode;
//13 为 回车
if(a==13) {
window.location.href = document.getElementById('toBookChapter').href;
}
//37 为 左键
else if(a==37){
window.location.href = document.getElementById('toPrevChapter').href;
}
//39 为 右键
else if(a==39){
window.location.href= document.getElementById('toNextChapter').href;
}
else{
return false;
}
};
</Script>JS禁止右键,捕捉回车等键盘操作
最新推荐文章于 2024-08-28 23:54:12 发布
本文介绍了一个使用JavaScript编写的脚本,该脚本通过监听键盘事件实现网页导航功能,包括使用回车键跳转到指定章节,方向键进行前后章节切换,并禁用了文本选择等功能。
5165

被折叠的 条评论
为什么被折叠?



