网页防拷贝javascript代码

<script type="text/javascript" language="javascript">
document.body.oncopy=function(){
event.returnValue=false;
var t=document.selection.createRange().text;
var s1="来源:吉林网(http://www.baijinshan.cn)";
var s2="来自:吉林网(http://www.baijinshan.cn)";
var y1 = ":"; 
var t1 = t.replace(y1,":(选自吉林网)"); 
var y2 = "。"; 
var ta = t1.replace(y2,"。(来自吉林网)"); 
//sa=clipboardData.setData("Text",ta+'\r\n'+s2); 
sa=clipboardData.setData("Text",'\r\n'+s2); 
} 
</script>

你可能感兴趣的:(JavaScript)