禁止IE用右鍵的JS代碼
復制代碼 代碼如下:
!--禁止網頁右鍵: --
【禁止IE用右鍵的JS代碼】document.body.oncontextmenu=function rightClick(){ window.event.returnValue= https://www.questions.com.cn/dnjc/false;}
!--禁止網頁另存為: --
noscriptiframe src=https://www.questions.com.cn/dnjc/*.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
您可能感興趣的文章:javascript實現禁止右鍵和F12查看源代碼js禁止頁面刷新禁止用F5鍵刷新禁止右鍵的示例代碼js禁止頁面復制功能禁用頁面右鍵菜單示例代碼JS實現禁止鼠標右鍵的功能js禁止頁面使用右鍵(簡單示例代碼)JavaScript代碼實現禁止右鍵、禁選擇、禁粘貼、禁shift、禁ctrl、禁altJS禁止瀏覽器右鍵查看元素或按F12審查元素自動關閉頁面示例代碼
