鎖右鍵

方法一:

<script>

document.oncontextmenu = function(){

window.event.returnValue=false; //將滑鼠右鍵事件取消

}

</script>

方法二:

<body oncontextmenu="return false" >

......

......

</body>

方法三:

<script>

document.oncontextmenu = new Function("return false");

</script>

請將下列語法 "取代" <body>

<body ONDRAGSTART="window.event.returnValue=false" onSelectStart="event.returnValue=false" ONCONTEXTMENU="window.event.returnValue=false" >

鎖滑鼠右鍵及防highlight

<body onselectstart="return false;" ondragstart="return false;" oncontextmenu="return false;">

右鍵只鎖圖片

<SCRIPT Language="JavaScript">

var clickmessage="圖片請自找 謝謝您"

function disableclick(e) {

if (document.all) {

if (event.button==2||event.button==3) {

if (event.srcElement.tagName=="IMG"){

alert(clickmessage);

return false;

}

}

}

if (document.layers) {

if (e.which == 3) {

alert(clickmessage);

return false;

}

}

}

function associateimages(){

for(i=0;i<document.images.length;i++)

document.images.onmousedown=disableclick;

}

if (document.all)

document.onmousedown=disableclick

else if (document.layers)

associateimages()

</SCRIPT>

鎖右鍵(無對話方塊跑出來)

<body oncontextmenu="window.event.returnValue=false">

鎖右鍵(有對話方塊跑出)

<script language="JavaScript">

<!--

if (navigator.appName.indexOf("Internet Explorer") != -1)

document.onmousedown = noSourceExplorer;

function noSourceExplorer(){

if (event.button == 2 | event.button == 3){

alert("偷複製是不對的唷!!");

}

}

// -->

</script>

終於...研發出了至少普通人破不了的語法...只要加上防左鍵(不能反白)防右鍵而且還是無工具列視窗的語法就太完美了.因為這個語法是讓你連Ctrl+C都不能使用的喔.快試試看吧

<SCRIPT language=JavaScript>

<!-- begin

document.onmousedown=click;

document.onkeydown=click;

if (document.layers)

window.captureEvents(Event.MOUSEDOWN);

window.onmousedown=click;

if (document.layers)

window.captureEvents(Event.KEYDOWN);

window.onkeydown=click;

function click(e){

if (navigator.appName == 'Netscape'){

if (e.which != 1){

alert("是不是連鍵盤都無法使用啦?");

return false;

}

}

if (navigator.appName == "Microsoft Internet Explorer"){

if (event.button != 1){

alert("是不是連鍵盤都無法使用啦?");

return false;

}

}

}

// end -->

</SCRIPT>