标签:
1. JS 禁止右键
<script type="text/javascript">document.oncontextmenu=function(e){return false;}</script> <body onselectstart="return false"> ......
<style type="text/css"> body { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } </style>
如果是局部
Html代码
<style type="text/css"> .unselectable { -moz-user-select: -moz-none; -khtml-user-select: none; -webkit-user-select: none; /* Introduced in IE 10. See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/ */ -ms-user-select: none; user-select: none; } </style>
3. 完整实例:
<style type="text/css"> body { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } </style> <script langauge="javascript"> document.oncontextmenu=function(e){return false;} </script> </head> <body onselectstart="return false"> ... ...
参考: http://outofmemory.cn/code-snippet/310/css-disable-user-select-text-jianrong-suoyou-liulanqi
或者:
javascript 实现禁止右键,复制,选取文本 (兼容firefox,IE,chrome等主流浏览器)
标签:
原文地址:http://www.cnblogs.com/webfby/p/4959266.html