张杰剑心qq空间链接:如何禁止复制网页内容

来源:百度文库 编辑:高校问答 时间:2024/05/01 22:49:09
我知道的代码是那种如果在页面上拖动鼠标左或者右键就会弹出一个[警告]之类的话的那种..
可是我不想要这样的.
我想问问有没人能告诉我一种什么也不会弹出,但实际上就是不复制的呢.也不能反白或者使用[ctrl+]的方法的..
就是无论点鼠标左键或者右键网页都没有反应的方法..
因为我的确看到有网页是这么做的.
我知道即使这样也一样有办法可以复制.但是我还是想知道这是怎么弄的.谢谢.

用JAVA禁止复制网页内容<Script Language=javascript>
function key(){
//if(event.shiftKey){
//window.close();}
//禁止shift
if(event.altKey){
alert('禁止CTRL-C复制本贴内容');}
//禁止alt
if(event.ctrlKey){
alert('禁止CTRL-C复制本贴内容');}
//禁止ctrl
return false;}
document.onkeydown=key;
if (window.Event)
document.captureEvents(Event.MOUSEUP);
//swordmaple javascript article.
//from www.jx165.com
//function nocontextmenu(){
//event.cancelBubble = true
//event.returnValue = false;
//return false;}
function norightclick(e){
if (window.Event){
if (e.which == 2 || e.which == 3)
return false;}
else
if (event.button == 2 || event.button == 3){
event.cancelBubble = true
event.returnValue = false;
return false;}
}
function Click(){
alert('禁止右键粘贴本贴内容');
window.event.returnValue=false;
}
document.oncontextmenu=Click;
</Script>

一个更简单的方法就是在<body>中加入如下的代码,这样鼠标的左右键都失效了.

topmargin="0" oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()"

1.禁止网页另存为:在<body>后面加入以下代码:
<noscript>
<iframe src="*.htm"></iframe>
</noscript>

2.禁止网页内容复制.粘贴:在<body>中加入以下代码:
<body onmousemove=\HideMenu()\ oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()">

这两种方法,试试看

百度下,很多的