禁止IE用右键的JS代码

网络编程 发布日期:2024/10/9 浏览次数:1

正在浏览:禁止IE用右键的JS代码

复制代码 代码如下:
<!--禁止网页右键: -->

document.body.oncontextmenu=function rightClick(){ window.event.returnValue= false;}

<!--禁止网页另存为: -->
<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>