标准版本 禁止复制代码

来源:互联网 发布:matlab列向量变成矩阵 编辑:程序博客网 时间:2024/06/10 10:48

<body oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()">

禁止复制代码

<SCRIPT language=javascript>

function click() {
alert('不能复制咯') }
function click1() {
if (event.button==2) {alert('欢迎来到我的BLOG!') }}
function CtrlKeyDown(){
if (event.ctrlKey) {alert('祝大家玩的开心!') }}
document.onkeydown=CtrlKeyDown;
document.onselectstart=click;
document.onmousedown=click1;
</SCRIPT>

加入下面的代码就好咯
<SCRIPT language=JavaScript>
function click(e) {
if (document.all) {
if (event.button==2||event.button==3) {
oncontextmenu='return false';
}
}
if (document.layers) {
if (e.which == 3) {
oncontextmenu='return false';
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
document.oncontextmenu = new Function("return false;")
</SCRIPT>
===========================================================================================
给个简单的
<script language="JavaScript">
  document.oncontextmenu=new Function("event.returnValue=false;"); </script>//禁止右键功能,单击右键
将无任何反应
<script language="JavaScript">document.onselectstart=new Function("event.returnValue=false;");</script> //禁止先择,也就是无法复

原创粉丝点击