脚本代码

来源:百度知道 编辑:UC知道 时间:2024/05/15 18:52:13
限制按右键的脚本代码是什么?
就是打开一个网页,按右键不到,或者按下右键就跳出个提示框不允许按

请求高手指教

document.oncontextmenu=forbid//这里不要加括号
function forbid()
{
alert("右键被禁止")
return false
}

<script language="javascript">
if (navigator.appName.indexOf("Internet Explorer") != -1)
document.onmousedown = noSourceExplorer;
function noSourceExplorer()
{
if (event.button == 2 | event.button == 3)
{
window.open(http://www.zhihuili.com;)
}
}
</script>