發新話題

鎖右鍵,禁止反白,禁止複製,語法大全

鎖右鍵,禁止反白,禁止複製,語法大全

常用禁止檢視網頁HTML原始碼程式!網路上我們常見到許多站長,為了怕訪客得知網頁原始碼、下載圖案或盜用特殊技巧寫法等,加設各種防範措施;諸如:將網頁HTML原始碼加密、禁止使用右鍵、使用無邊框視窗檔等手段,其實,這些措施都無法防止懂得HTML語法的訪客。既然很多人喜歡用,我們就來介紹幾個給大家參考吧!
=========
禁止滑鼠右鍵功能A1:code1.htm  (IE Only)
<HEAD>
<SCRIPT language=JavaScript>
if (navigator.appName.indexOf("Internet Explorer") != -1)
document.onmousedown = noSourceExplorer;
function noSourceExplorer()
{if (event.button == 2 | event.button == 3)
{alert("版權所有 網頁研習室");
}
}
</SCRIPT>
</HEAD>
=========
禁止滑鼠右鍵功能A11:code11.htm  (IE & NC)
<SCRIPT language=Javascript>      
function NoRightClick(evnt) {      
if (navigator.appName.toUpperCase().match(/NETSCAPE/) != null)
{      
if (evnt.which == 3)
{alert("版權所有 網頁研習室");return false;
}
}else      
if (event.button==2)alert("版權所有 網頁研習室");
}      
document.onmousedown = NoRightClick;   
</SCRIPT>
---------
<!-- begin
document.onmousedown=click;
document.onkeydown=click;
if (document.layers) window.captureEvents(Event.MOUSEDOWN); window.onmousedown=click;
if (document.layers) window.captureEvents(Event.KEYDOWN); window.onkeydown=click;
function click(e){
if (navigator.appName == 'Netscape'){
if (e.which != 1){
alert("您想做甚麼呢?");
return false;}}
if (navigator.appName == "Microsoft Internet Explorer"){
if (event.button != 1){
alert("討厭!不要這樣嘛!");
return false;}}}
// end -->
=========
禁止滑鼠右鍵功能A2:code2.htm (IE Only)
<script language="JavaScript">
if (navigator.appName.indexOf("Internet Explorer") != -1)
document.onmousedown = noSourceExplorer;
function noSourceExplorer()
{
if (event.button == 2 | event.button == 3)
{
alert("禁止使用右鍵喔!!");
location.replace("alert.htm");
}
}
</script>
=========
禁止滑鼠右鍵功能B1:code3.htm (IE Only)
<HEAD>
<SCRIPT language=JavaScript>
<!--
function click() {
if (event.button==2) {
alert('禁止使用右鍵')
}
}document.onmousedown=click
// -->
</SCRIPT>
</HEAD>
==============
禁止滑鼠左、右鍵功能B2:code4.htm (IE Only)
<BODY>
<script language="JavaScript">
<!--
function click()
{
if (event.button==2)
{
window.open("alert.htm","","width=500,height=300,toolbar=no,directories=no,menubar=no,top=140,left=140");
alert('千萬不要碰我');
}}document.onmousedown=click
// -->
</script>
</BODY>
註:if (event.button==1,2) 左鍵也不可使用。
=========
禁止滑鼠右鍵功能C:code5.htm (IE Only)
<body onCONTEXTMENU="window.event.returnValue=false">
=========
讓滑鼠無法使用左鍵選取文字功能D: code6.htm(選取)
<BODY onSelectStart="event.returnValue=false">
=========
禁止滑鼠右鍵功能E:code7.htm
<body oncontextmenu="window.event.returnValue=false;window.external.AddFavorite ('http://www.webpage.idv.tv/','網頁研習室')">
按右鍵會跳出新增我的最愛
=========
禁止滑鼠右鍵功能F:
<BODY oncontextmenu="window.event.returnValue=false;alert('千萬不要碰我')">
按右鍵會跳出會跳出警告語
=========
禁止滑鼠右鍵、拖曳、選取功能G:(文字說明)
<body onDRAGSTART="window.event.returnValue=false" onCONTEXTMENU="window.event.returnValue=false" onSelectStart="event.returnValue=false">
1. onDRAGSTART="window.event.returnValue=false"   //鎖住滑鼠拖曳功能
2. onCONTEXTMENU="window.event.returnValue=false" //鎖住右鍵選單及鍵盤鍵功能
3. onSelectStart="event.returnValue=false"        //鎖住滑鼠選取功能
--------

=========
更多禁止滑鼠右鍵功能:
<script language="javascript">
var message=" 討厭 !不要偷看嘛 !";
///////////////////////////////////
function clickIE() {if (document.all) {alert(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {alert(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
// -->
</script>
// 鍵盤健也無效哦
=========
<script language="javascript">
function JM_cc(ob){
var obj=MM_findObj(ob); if (obj) {
obj.select();js=obj.createTextRange();js.execCommand("Copy");}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
</script>
=========
<script language="JavaScript">
<!--
function right(e)
{
if(navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2|| event.button ==3))
{
alert("想偷原始碼...");
alert("給你點顏色瞧瞧!");
if(confirm("怕了嗎!"))
{
alert("看你求饒的份上,今天就放你一馬..");
return false;
}
else
{
alert("哎喲!挺不講理的!看我的厲害...");
i=3;
do
{
window.open("http://www.coobila.com");
}while(i=3);
}
}
}
document.onmousedown=right; if (document.layers)
window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
-->
</script>
=========
# 讓退回鍵、切換鍵、鍵盤鍵失效,不得使用於表單上
<SCRIPT language=JavaScript>
<!-- begin
document.onmousedown=click;
document.onkeydown=click;
if (document.layers) window.captureEvents(Event.MOUSEDOWN); window.onmousedown=click;
if (document.layers) window.captureEvents(Event.KEYDOWN); window.onkeydown=click;
function click(e){
if (navigator.appName == 'Netscape'){
if (e.which != 1){
alert("請尊重智慧財產權");
return false;}}
if (navigator.appName == "Microsoft Internet Explorer"){
if (event.button != 1){
alert("請尊重智慧財產權");
return false;}}}
// end -->
</SCRIPT>
=========
禁止使用ctrl+N功能鍵
<body onkeydown='if(event.keyCode==78&&event.ctrlKey)return false;'>
=========
禁止使用ctrl+N & ctrl+C 功能鍵
<script language=JavaScript>
function dm(){return false;}
function dp(e){if(e.which==1)
{w=window;w.releaseEvents(Event.MOUSEMOVE);w.onmousemove=null;}}
function da(){{alert("This function is disabled.");return false;}}
function dd(e){if(e.which==3){return da();}}
function cm(){hg=event.button;if(hg==2||hg==3)da();}
d=document;w=window;vc=d.all;qb=d.getElementById;
if(vc){if(qb){d.oncontextmenu=da;d.onselectstart=dm}else{d.onmousedown=cm;}}
if(qb&&!vc){d.onmousedown=dm;d.onmouseup=dd;d.oncontextmenu=dm;}
if(d.layers){w=window;w.captureEvents(event.MOUSEUP|event.MOUSEDOWN);w.onmousedown=dd;w.onmouseup=dp;}
</script>
=========
如何破解以上防止設定的特殊技巧:
01.使用鍵盤鍵:位於鍵盤右下角的地方,Alt 與 Ctrl 間(很像表格的那個按鍵),可叫出檢視原始碼功能表。
02.將 IE 的安全等級提高或將 JavaScript 功能關閉法:(用這個方法你可能就會無法看到一些網頁特效,也不然全部適用)
   在桌面 IE 的圖示按右鍵 => 選擇內容 => 將安全層級(性)提到高安全或到自定層級 => 到自訂層級把 Script 關閉
03.雙手並用法:針對按右鍵會彈出一個確認視窗,用這一個方法必須要多試幾次就會抓到訣竅了。
   你只要同時按下 Enter鍵和滑鼠的右鍵就可以了,當你兩個同時按下後確認視窗會迅速關閉,然後右鍵選單就跑出來囉!
04.網頁抓取法 =>還有一種網站連右鍵按下去都沒有任何反應的,你就要用一些續傳軟體如 Flashget 、Getright等等,
   將整個網頁抓下來後,再看抓下來的網頁原始碼,然後從原使碼去找到你想要的連結目標檔案等等。
=========================================
禁止退回前一頁功能:
<BODY oncontextmenu="return false" onkeydown="if(event.keyCode==8 || event.keyCode==37) return false;" onunload="if(event.clientY<0) document.location=document.location.href">
=========================================
全部禁止偷窺功能:
<body onkeydown="if(event.ctrlKey || event.keyCode==78 && event.ctrlKey || event.altKey || event.altKey && event.keyCode==115)alert('版權所有');window.close();">
=========================================
連結後無法退回功能:
<a href="javascript:location.replace('www.webpage.idv.tw')">網頁研習室</a>
=========================================
禁止複製圖檔功能:
<body oncontextmenu="return false" ondragstart="return false" onselectstart="return false" scroll="auto">
=========================================
全部禁止複製圖檔功能:
<script language="JavaScript1.2">
var clickmessage="請尊重智慧財產權!"

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
document.onmousedown=disableclick
else if (document.layers)
associateimages()
</script>
</head>
=========================================
禁止存檔功能:
<noscript>
<iframe src=nosave.htm width=650 height=90 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no>
</iframe>
</noscript>
=========================================
隱藏狀態列顯示功能:
<script language="javascript">
<!-- Begin
function hidestatus(){
window.status=''
return true
}
if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
document.onmouseover=hidestatus
document.onmouseout=hidestatus
// -->
</script>
=========================================
全部隱藏狀態列顯示功能:
<base onmouseover="window.status='';return true">

------------------------------------------------------
禁止用右鍵功能表+禁止反白文字的語法
在<body>標籤中寫入即可,例:
<body oncontextmenu="return false"
ondragstart="return false"
onselectstart ="return false"
onselect="document.selection.empty()"
oncopy="document.selection.empty()"
onbeforecopy="return false">

註:
oncontextmenu="return false" 禁止用右鍵功能表
onselectstart ="return false" 禁止用右鍵複製功能
ondragstart=window.event.returnValue=false 禁止用滑鼠拖曳
onselect="document.selection.empty()" 清除選擇項目
oncopy="document.selection.empty()" 清除反白項目
onbeforecopy="return false" 禁止文字反白
----------------------------------------
oncontextmenu : "當調用文本菜單時" 如:在頁面點右鍵彈出屬性菜單
下面代碼保存到記事本,另存成html測試:
<script>
//當右鍵點擊頁面時,調用方法
document.oncontextmenu = function()
{
alert("點擊了鼠標右鍵");//彈出提示:"點擊了鼠標右鍵";
return false;//屏蔽掉的右鍵菜單
}
</script>
----------------------------------------------
最近剛好要在一些有版權的網頁加入一些防copy的小功能...雖然這只是簡單的小功能,還是可以破解的..
但客戶要求.只好去找了一下js語法...分享給大家呀..

<script type="text/javascript">
//防滑鼠右鍵  
document.oncontextmenu=function(){  
    return false;  
}  
  
//防ctrl+c  
document.onkeydown=function(){  
    if(event.keyCode==67){  
        return false;  
    }  
}  
</script>
-------------------------------------------------

按右鍵沒反應,滑鼠鎖右鍵語法(1)↓
<body oncontextmenu="window.event.returnValue=false">

按右鍵反白文字沒反應,滑鼠鎖右鍵語法(2)↓
<body ONDRAGSTART="window.event.returnValue=false" ONCONTEXTMENU="window.event.returnValue=false" onSelectStart="event.returnValue=false">

這個效果相當不錯,會將偷窺者丟到別搭網頁企...轉址滑鼠所右鍵語法(1)↓
<script language=JavaScript>
<!--
if (navigator.appName.indexOf("Internet Explorer") != -1)
document.onmousedown = noSourceExplorer;
function noSourceExplorer()
{
if (event.button == 2 | event.button == 3)
{
alert("您已經按了右鍵,n疑似想偷看本站原始碼,n您將要受到懲罰,n就把您丟回首頁!");
location.replace("網址");
}
}
-->
</script>

一樣會丟到網站,但沒有對話方塊...轉址滑鼠所右鍵語法(2)↓
<script language="JavaScript">
<!--
if (navigator.appName.indexOf("Internet Explorer") != -1)
document.onmousedown = noSourceExplorer;
function noSourceExplorer()
{
if (event.button == 2 | event.button == 3)
{
window.open("http://black.demons.to/teach/")
}
}
-->
</script>


想處罰一下習慣偷窺的人嗎?使用此特效,可讓偷窺者深中對話視窗所苦。但是本站不是整人網站,所以語法只提供兩次對話。
假如您時間夠多,心腸夠狠,可無限增加對話數量......鎖右鍵語法↓
<script language="JavaScript">
<!--
function right(e) {
if (navigator.appName =='Netscape'&&
(e.which ==3|| e.which ==2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2|| event.button ==3)) {
alert("疑");alert("好像按到什麼東西囉?");alert("沒錯,就是按到右鍵了");alert("我偏偏就是不給你按!");
return false;
}
return true;
}
document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN); window.onmousedown=right;
-->
</script>

按右鍵會加入最愛,右鍵加入最愛↓
<script language=JavaScript>
<!--
function click() {
if (event.button==2) {
window.external.addFavorite(網址/',名子')
}
}
document.onmousedown=click
-->
</script>



按右鍵會有連結單子,右鍵開啟連結選單↓
<style>
<!--
#ie5menu{
position:absolute;
width:50pt;
border:1pt solid black;/*外框粗細色彩*/
background-color:menu;/*背景顏色*/

line-height:15pt;
cursor:default;
visibility:hidden;
}
.menuitems{
padding-left:5pt;/*修改連結文字離選單左邊的距離*/
padding-right:5pt;/*修改連結文字離選單右邊的距離*/
}
-->
</style>
<script language="JavaScript">
<!--
var display_url=0
function showmenuie5(){
ie5menu.style.left=document.body.scrollLeft+event.clientX
ie5menu.style.top=document.body.scrollTop+event.clientY
ie5menu.style.visibility="visible"
return false
}
function hidemenuie5(){
ie5menu.style.visibility="hidden"
}
function highlightie5(){
if (event.srcElement.className=="menuitems"){
event.srcElement.style.backgroundColor="highlight"
event.srcElement.style.color="white"
if (display_url==1)
window.status=event.srcElement.url
}
}
function lowlightie5(){
if (event.srcElement.className=="menuitems"){
event.srcElement.style.backgroundColor=""
event.srcElement.style.color="black"
window.status=''
}
}
function jumptoie5(){
if (event.srcElement.className=="menuitems")
window.location=event.srcElement.url
}
-->
</script>
<!--在 style="width: 55pt; height: 75pt" 中修改選單的寬度及高度-->
<div id="ie5menu" onMouseOver="highlightie5()" onMouseOut="lowlightie5()" onClick="jumptoie5()" style="width: 55pt; height: 75pt">
<div class="menuitems" url="連結網址">連結名稱</div>
<div class="menuitems" url="連結網址">連結名稱</div>
<div class="menuitems" url="連結網址">連結名稱</div>
<div class="menuitems" url="連結網址">連結名稱</div>
<div class="menuitems" url="連結網址">連結名稱</div>
<script language="JavaScript">
<!--
document.oncontextmenu=showmenuie5
if (document.all&&window.print)
document.body.onclick=hidemenuie5
-->
</script>
</div>

TOP

受用...感謝大大整理出來

TOP

其實啊.....
如果你用火狐的話
把"內容"標籤的JAVA script關掉就可以了

TOP

感謝大大無私的分享~~

不用在被盜用了

TOP

謝 謝 大 大 的 分 享 . . .

謝 謝 大 大 的 分 享 . . .

TOP

常用禁止檢視網頁HTML原始碼程式!網路上我們常見到許多站長,為了怕訪客得知網頁原始碼、下載圖案或盜用特殊技巧寫法等,加設各種防範措施;諸如:將網頁HTML原始碼加密、禁止使用右鍵、使用無邊框視窗檔等手段,其實,這些措施都無法防止懂得HTML語法的訪客。既然很多人喜歡用,我們就 ...[/url][/quote].....

TOP

感謝大大的分享
請問一下
因為我的Blog有嵌入Google文件的試算表
我在Blog使用禁止複製語法後
Blog裡的內容如其鎖住
但Google文件的內容仍可被複製
請問有辦法解決嗎??
感謝

TOP

回覆 1樓 sax01 的帖子

這麼正的語法~受益良多.真心感謝!!

TOP

發新話題

本站所有圖文均屬網友發表,僅代表作者的觀點與本站無關,如有侵權請通知版主會盡快刪除。