日期:2014-05-16  浏览次数:20371 次

JS禁止右键,捕捉回车等键盘操作
<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>