同時適合IE、firefox、Google瀏覽器下適用,經過篩選程式碼如下:
//按键时提示警告
function key(e){
var keynum;
if(window.event){
keynum = e.keyCode; // IE
}else if(e.which){
keynum = e.which; // Netscape/Firefox/Opera
}
if(keynum == 17){
alert(“禁止复制内容!”);
return false;
}
}
//禁用右键、文本选择功能、复制按键
$(document).bind("contextmenu",function(){return false;});
$(document).bind("selectstart",function(){return false;});
$(document).keydown(function(){return key(arguments[0])});
//按键时提示警告
function key(e){
var keynum;
if(window.event) // IE
{
keynum = e.keyCode;
}
else if(e.which) // Netscape/Firefox/Opera
{
keynum = e.which;
}
if(keynum == 17){ alert("禁止复制内容!");return false;}
}
<script> <BR>//遮罩滑鼠右鍵、Ctrl N、Shift F10、F11、F5刷新、退格鍵 <BR>function ;}//屏蔽滑鼠右鍵 <BR>function window.onhelp(){return false} //屏蔽F1幫助 <BR>function 🎜 > ((window.event.keyCode==37)|| //遮蔽Alt 方向鍵← <BR> →<BR> alert("不允許使用ALT 方向鍵前進或後退網頁! //遮蔽退格刪除鍵 <BR> (event.keyCode==116)|| //遮蔽F5刷新鍵 <BR> ( event.keyCode=0; <BR> event .returnValue=false; <BR> } <BR> if(event.keyCode==122){event.keyCode=0 && event. keyCode==78)event.returnValue=false; //屏蔽Ctrl n <BR> if(event.shiftKey && event.keyCode==121)event.returnValue=false; . event.srcElement.tagName=="A" && window.event.shiftKey) <BR> window.event.returnValue=false; altKey)&&(window.event.keyCode==115)){ //屏蔽Alt F4 <BR> ): window ; <BR> return false; <BR> } <BR> } <BR></script>