左右鍵防止網頁複製

將下列程式碼複製至<head>程式碼</head>區內

<script>
<!--
function right(mousebutton)
{
var msg1 = "您好 鄉城風情網站,提供您最新的範例程式!!試試您的右鍵!!";
var msg2 = "給予敝站的支持,才有更多的源力走下去!";

if (navigator.appName == 'Netscape' && mousebutton.which==3)
{
alert(msg1);
return false;
}
else

if (navigator.appName == 'Netscape' && mousebutton.which==1)
{
alert(msg2);
return false;
}
else

if (navigator.appName == 'Microsoft Internet Explorer' && event.button == 1)
{
alert(msg1);
return false;
}
else

if (navigator.appName == 'Microsoft Internet Explorer' && event.button == 2)
{
alert(msg2);
return false;
}
return true;
}
document.onmousedown = right;
// -->
</script>