<body oncontextmenu=”return false”></body>
<!– 禁用右鍵: –>
<script> function stop(){ return false; } document.oncontextmenu=stop; </script>
<body onselectstart=”return false”> 取消選取、防止復制
oncopy=”return false;” oncut=”return false;” 防止復制
四:禁止查看源文件
<html> <head> <script> function clear(){ Source=document.body.firstChild.data; document.open(); document.close(); document.title=”看不到源代碼”; document.body.innerHTML=Source; }</script> </head>
五、圖片下載限制
<script language=”javascript”> function Click(){ if(window.event.srcElement.tagName==”IMG”) { alert(‘圖片直接右鍵’); window.event.returnValue=false; } } document.oncontextmenu=Click; </script> <META HTTP-EQUIV=”imagetoolbar” CONTENT=”no”> 插入圖片時加入galleryimg屬性 <img galleryimg=”no” src=””>
禁止右鍵保存
把下面代碼放在<head>和</head>之間
<SCRIPT LANGUAGE=java script> function click() { alert(‘對不起,您不能保存此圖片,謝謝您的理解和支持!’) } function click1() { if (event.button==2) {alert(‘對不起,您不能保存此圖片,謝謝您的理解和支持!’) }} function CtrlKeyDown(){ if (event.ctrlKey) {alert(‘不當的拷貝將損害您的系統!’) }} document.onkeydown=CtrlKeyDown; document.onselectstart=click; document.onmousedown=click1; </SCRIPT>
方式二:
在頁面中加入如下js代碼:原理:屏蔽右鍵
<script> function document.onmousedown() { if(event.button==2||event.button==3) { alert( “右健被禁止 “) return false } } </script>
網頁防復制代碼 禁止查看網頁源文件代碼
插入網頁即可。
<body leftmargin=”2″ topmargin=”0″ marginwidth=”0″ marginheight=”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()”> <noscript><iframe src=”/blog/*>”;</iframe></noscript>
1. oncontextmenu=”window.event.returnvalue=false” //將徹底屏蔽鼠標右鍵 <table border oncontextmenu=return(false)><td>no</table> //可用於Table 2. <body onselectstart=”return false”> //取消選取、防止復制 3. onpaste=”return false” //不准粘貼 4. oncopy=”return false;” oncut=”return false;” // 防止復制
5. //防止被人frame
<SCRIPT LANGUAGE=javascript><!– if (top.location != self.location)top.location=self.location; </SCRIPT>
6.
<noscript><iframe src=”/blog/*.html>”;</iframe></noscript> //網頁將不能被另存為
7. //改變連接是狀態欄的顯示內容
〈a href=”http://v.2best.cc” onMo … ;window.status=’輸入連接狀態欄顯示內容’;return true”>
8. //禁止網頁中目標對象被下載(如圖片)
下面的代碼將幫助你禁止網頁中目標對象被下載:
<a href=”javascript:void(0)” onMouseDown=”alert(‘對不起!圖片不能下載!’)”> </a>
9. //頁面禁止刷新完全
最好在pop出來的窗口里用,沒工具欄的
<body onkeydown=”KeyDown()” onbeforeunload=”location=location” oncontextmenu=”event.returnValue=false”> <script language=”Javascript”><!– function KeyDown(){ if ((window.event.altKey)&& ((window.event.keyCode==37)|| (window.event.keyCode==39))){ alert(“請訪問我的主頁”); event.returnValue=false; } if ((event.keyCode==8)|| (event.keyCode==116)){ //屏蔽 F5 刷新鍵 event.keyCode=0; event.returnValue=false; } if ((event.ctrlKey)&&(event.keyCode==78)){ //屏蔽 Ctrl+n event.returnValue=false; } if ((event.shiftKey)&&(event.keyCode==121)){ //屏蔽 shift+F10 event.returnValue=false; } } </script> </body
加入收藏
加入收藏 < a onclick="AddFavorite(window.location,document.title)" >加入收藏< /a> function AddFavorite(sURL, sTitle) { try { window.external.addFavorite(sURL, sTitle); } catch (e) { try { window.sidebar.addPanel(sTitle, sURL, ""); } catch (e) { alert("加入收藏失敗,請使用Ctrl+D進行添加"); } } }
設為首頁
設為首頁 < a onclick="SetHome(this,window.location)" > 設為首頁 < /a> function SetHome(obj,vrl){ try{ obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl); } catch(e){ if(window.netscape) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch (e) { alert("此操作被瀏覽器拒絕!\n請在瀏覽器地址欄輸入“about:config”並回車\n然后將 [signed.applets.codebase_principal_support]的值設置為'true',雙擊即可。"); } var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch); prefs.setCharPref('browser.startup.homepage',vrl); } } } 使用 < a href="#" onclick="SetHome(this,window.location)" > 設為首頁 < /a> < a href="#" onclick="AddFavorite(window.location,document.title)"> 收藏本站 < /a>