<body oncontextmenu="return false">禁用網(wǎng)頁右鍵菜單,但是仍然可以使用快捷鍵復(fù)制。
js代碼禁用復(fù)制功能:
復(fù)制代碼 代碼如下:
<script type="text/javascript">
document.body.onselectstart=document.body.oncontextmenu=function(){ return false;}
</script>
復(fù)制代碼 代碼如下:
<body oncontextmenu="return false" onselectstart="return false"
ondragstart="return false" oncopy="return false"
oncut="return false;
leftMargin=0
topMargin=0 >
以下代碼是禁用網(wǎng)頁另存為但是我測試沒有成功,誰知道原因可以在下面給出評論,謝謝。
<noscript>
<iframe scr="*.htm"></iframe>
</noscript>
</body>
復(fù)制代碼 代碼如下:
//******************** 屏蔽右鍵 ***********************
function click(e) {
if (document.all) {
if (event.button==1||event.button==2||event.button==3) {
oncontextmenu='return false';
}
}
if (document.layers) {
if (e.which == 3) {
oncontextmenu='return false';
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
document.oncontextmenu = new Function("return false;")
//*******************************************
document.onkeydown=function(evt){
if(document.selection.createRange().parentElement().type == "file"){
return false;
}
if ((event.keyCode==116)|| //屏蔽 F5 刷新鍵
(event.ctrlKey && event.keyCode==82)){ //Ctrl + R
event.keyCode=0;
event.returnValue=false;
}
if ((window.event.altKey)&&(window.event.keyCode==115)){ //屏蔽Alt+F4
return false;
}
}
新聞熱點
疑難解答
圖片精選