//禁用右键菜单 IE和chrome
document.oncontextmenu = function (){ return false;}
//防止内容被选中默认状态是true IE和chrome
document.onselectstart = function (){ return false;}
//禁止鼠标在网页上拖动IE和chrome
document.ondragstart = function (){ return false;}
//兼容火狐
css_string = '*{-webkit-user-select: none; -khtml-user-select: none; -moz-user-select:none; -ms-user-select: none;user-select: none;}';
document.write('<style type="text\/css">' + css_string + '<\/style>');
//兼容火狐
备注:适用于偷懒分子(⊙0⊙)
备注:适用于偷懒分子(⊙0⊙)
本文介绍了一种通过JavaScript和CSS实现禁用浏览器页面上的右键菜单、阻止内容被选中以及禁止鼠标拖动的方法。适用于IE、Chrome和Firefox等主流浏览器。
590

被折叠的 条评论
为什么被折叠?



