<script type="text/javascript">
function block(oEvent){
if(window.event)
oEvent=window.event;
if(oEvent.button==2)
alert("鼠标右键不可用");
}
document.onmousedown=block;
</script>
js控制在网页中禁用右键和禁止另存为的代码。<div oncontextmenu='return false' onselectstart ='return false'
onselect='document.selection.empty()' oncopy='document.selection.empty()'
onbeforecopy='return false'>
内容区域
</div>
不用js也可以控制禁止右键!方法:
<body oncontextmenu="return false"></body>
下边是三个不同的禁用右键的方法!有详细的使用说明!
http://www.baron.com.cn/javascript/shu/shu10.htm
http://www.baron.com.cn/javascript/shu/shu5.htm
http://www.baron.com.cn/javascript/skill/20020110skill3.htm
<!--禁止网页另存为: -->
<noscript><iframe src=*.html></iframe></noscript>
<!-- 禁止选择文本: -->
<script type="text/javascript">
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}
function reEnable(){
return true
}
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
</script>
<!-- 禁用右键: -->
<script>
function stop(){
return false;
}
document.oncontextmenu=stop;
</script>