禁止IE用右鍵的JS代碼
<!--禁止網(wǎng)頁右鍵: -->
document.body.oncontextmenu=function rightClick(){ window.event.returnValue= false;}
<!--禁止網(wǎng)頁另存為: -->
<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>
相關文章
JavaScript實現(xiàn)網(wǎng)頁版簡易計算器功能
這篇文章主要介紹了JavaScript實現(xiàn)網(wǎng)頁版簡易計算器功能,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2022-07-07使用TypeScript實現(xiàn)一個類型安全的EventBus示例詳解
EventBus是工作中常用的工具,本文用Typescript實現(xiàn)一個具備基礎功能且類型安全的EventBus,是我近期學習Typescript的知識總結,對TypeScript實現(xiàn)EventBus相關知識感興趣的朋友一起看看吧2022-06-06微信小程序用戶授權環(huán)節(jié)實現(xiàn)過程
這篇文章主要介紹了微信小程序用戶授權環(huán)節(jié)實現(xiàn)過程,在商城項目中,我們需要對部分的頁面,進行一個授權的判別,例如購物車,及個人中心,需要完成用戶信息的授權后,獲取到相關信息2023-01-01