将如下代码加入HTML的<head>区:
<script language="JavaScript">
if (navigator.appName.indexOf("Internet Explorer") != -1)
document.onmousedown = noright;
function noright()
{
if (event.button == 2 | event.button == 3)
{
alert("页面代码不能随便看啊!");
history.go(0); //刷新当前页
}
}
</script>如果将 history.go(0); 替换为
 location.replace("http://指定的url"); 则导向一个指定的页面。