JS禁用右鍵,禁用列印,防止另存為,IE瀏覽器識別
function isIE6(){ String.prototype.inc=function(k1,k2){return k2==null?this.indexOf(k1)>-1?true:false:(k2+this+k2).indexOf(k2+k1+k2)>-1?true:false} var agent=navigator.userAgent var isIE,isIE4,isIE5,isIE6,isOpr,isMoz isOpr=agent.inc("Opera") isIE=agent.inc("IE")&&!isOpr isIE4=agent.inc("IE 4") isIE5=agent.inc("IE 5")||agent.inc("IE 4") isIE6=isIE&&!isIE5 isMoz=agent.inc("Mozilla")&&!isOpr&&!isIE if(!isIE6){ alert("您使用的瀏覽器不是IE或版本太低,建議使用IE6.0及以上版本的瀏覽器進行報名!"); } }
oncontextmenu="window.event.returnValue=false" style="overflow-y: hidden; overflow-x: hidden"ajs9 leftmargin="0" topmargin="0"
<body oncontextmenu="return false"></body>
<!--禁止網頁另存為: -->
<noscript><iframe src=*.html></iframe></noscript>
<!-- 禁止選擇文字: -->
<script type="text/javascript">
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}
function reEnable(){
return true
}
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
</script>
<!-- 禁用右鍵: -->
<script>
function stop(){
return false;
}
document.oncontextmenu=stop;
</script>
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. <link rel="Shortcut Icon" href="favicon.ico"> IE位址列前換成自己的圖示
6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夾中顯示出你的圖示
7. <input style="ime-mode:-Disabled"> 關閉輸入法
8. 永遠都會帶著框架
<script language="javascript"><!--
if (window == top)top.location.href = "frames.htm"; //frames.htm為框架網頁
// --></script>
9. 防止被人frame
<SCRIPT LANGUAGE=javascript><!--
if (top.location != self.location)top.location=self.location;
// --></SCRIPT>
11. <input type=button value=檢視網頁原始碼
onclick="window.location = `view-source:`+ http://www.tonightdream.com/`";>
12.刪除時確認
<a href=`javascript:if(confirm("確實要刪除嗎?"location="boos.asp?&areyou=刪除&page=1"`>刪除</a>
13. 取得控制元件的絕對位置
//javascript
<script language="javascript">
function getIE(E){
var t=e.offsetTop;
var l=e.offsetLeft;
while(e=e.offsetParent){
t+=e.offsetTop;
l+=e.offsetLeft;
<!--右鍵開始-->
<script language="JavaScript">
<!--
if (window.Event)
document.captureEvents(Event.MOUSEUP);
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;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
//-->
</script>
<!-- 禁止選擇文字: -->
<script type="text/javascript">
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}
function reEnable(){
return true
}
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
</script>
<script language="javascript" type="text/javascript">
<!--
function key(){
if(event.shiftKey){
window.close();}
//禁止shift
if(event.altKey){
window.close();}
//禁止alt
if(event.ctrlKey){
window.close();}
//禁止ctrl
return false;}
//document.onkeydown=key;
if (window.Event)
document.captureEvents(Event.MOUSEUP);
//swordmaple javascript article.
//from http://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;}
}
//禁止右鍵
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
//-->
</script>
---------------
要真正禁止列印頁面是辦不到的,但是如果能設定讓使用者列印到的是空白,也算是實現禁止列印的目的了
<html>
<head><title>不可列印的頁面</title>
<style>
@media print{
body{display:none}
}
</style>
</head>
<body>
文件主要內容
</html>
相關推薦
JS禁用右鍵,禁用列印,防止另存為,IE瀏覽器識別
function isIE6(){ String.prototype.inc=function(k1,k2){return k2==null?this.indexOf(k1)>-1?true:false:(k2+this+k2).indexOf(k2+k1+k2)&g
Word列印目錄或另存為PDF時出現“錯誤!未定義書籤!”的解決辦法
今天在單獨列印一份三頁的目錄Word文件時,所有目錄的頁碼全部變為“錯誤!未定義書籤!”,很是奇妙!一開始還以為是列印問題,又重新列印了一次,問題依舊。後來經過仔細研究,發現是“域”的問題。 解決辦法:全選(Crtl+A),按下Crtl+F11,再列印或者另存為PDF
H5_0003:JS禁用調試,禁用右鍵,監聽F12事件的方法
amp log rom 條件 wid turn ref return text 1,禁用調試 // 這個方法是防止惡意調試的 (function () { console["log"]("============================
2019-3-22c# TextBox只允許輸入數字,禁用右鍵粘貼,允許Ctrl+v粘貼數字
enabled clas exception 分享 rdquo span ^c 數字 禁用右鍵 TextBox 禁止復制粘貼 ShortcutsEnabled =false TextBox只允許輸入數字,最大長度為10 //TextBox.Shor
js 禁用右鍵選單、拖拽、選中、複製
//禁用拖拽 document.ondragstart = function () { return false; }; /** * 禁用右鍵選單 */ document.oncontextmenu = function () { event.retu
Js實現——右鍵出現選單,選單中有新建,複製,剪下,貼上,刪除
描述: 單擊右鍵出現選單,選單中有新建,複製,剪下,貼上,刪除 選擇新建時,建立第一個div,寬高50,顏色隨機,並且放在滑鼠點選的位置 點選div,div被選中,加邊線,如果被選中,div可以被拖動,當選擇別的d
【JavaScript】jquery右鍵點選事件和js禁用右鍵事件程式碼
jQuery滑鼠點選事件函式//jQuery滑鼠左擊、右擊和中擊事件 $('div').mousedown(function(e){ if(e.which == 3){ alert(
禁止網頁另存為 右鍵,左鍵等
htm ram func lec cts script 禁止 alert start 禁止另存為, <body></body> 標簽裏面寫入 <noscript><iframe src=‘*.htm‘></i
jQuery禁用右鍵、文字選擇功能、複製按鍵
//禁用右鍵、文字選擇功能、複製按鍵 $(document).bind(“contextmenu”,function(){return false;}); $(document).bind(“selectstart”,function(){return false;}); $(document).keydo
jquery禁用右鍵、文字選擇功能、複製按鍵的實現
同時適合IE、firefox、谷歌瀏覽器下適用,經過篩選程式碼如下: Java程式碼 //禁用右鍵、文字選擇功能、複製按鍵$(document).bind(“contextmenu”,function(){re
網頁右鍵、複製、另存為、快取等功能的禁用以及F12禁用
1、右鍵禁用 方法1: document.oncontextmenu = function () { return false; }方法2: document.onmousedown =
開發網站為“禁止複製”“禁用右鍵功能”(易被破解)
在開發中,希望網站內容不被選取、複製、禁用右鍵功能。可以再body標籤上加一些事件(最好在js檔案中寫,可以略微防止技術小白/小牛),但這對懂技術的人、網頁爬蟲沒有用滴。。。 <!DOCTY
jquery禁止複製、禁用右鍵、文字選擇功能、複製按鍵
本文章介紹的jquery禁用右鍵、文字選擇功能、複製按鍵的實現它可以相容瀏覽器有IE、firefox、谷歌瀏覽器,各位朋友可參考。IE瀏覽器是指以IE為核心的瀏覽器也支援,有360,QQ等 程式碼如下:
瀏覽器禁用右鍵選單
<script type="text/javascript"> function key(){ if(event.shiftKey){ window.close();} //禁止Shift if(event.altKey){ window.close();}
連結到 網頁中最常用的JS程式碼(js禁止右鍵、禁止複製)
<body oncontextmenu=”return false”></body> <!– 禁用右鍵: –> <script> function stop(){ return false; } document.oncontextmenu=st
js jQuery 右鍵選單 清屏
主要用到了oncontextmenu事件,在oncontextmenu事件中使用return false 遮蔽掉原生右鍵選單,再使用event獲取滑鼠的座標位置,設定自定義選單的位置。 http://swisnl.github.io/jQuery-contextM
JS禁止右鍵和F12檢視
$(document).bind("contextmenu", function () { return false; });//禁止右鍵 document.oncontextmenu = function () { ret
js禁止右鍵,禁止複製,複製內容到剪下板
有時候我們希望自己的網頁原始碼不被檢視,這時需要關掉滑鼠的右擊事件;有時候我們也希望禁止選擇頁面內容Ctrl+C複製。 1.禁止右鍵檢視原始碼; <script> //設定右鍵事件 function noMenuOne() { alert('禁止
40個js小技巧:遮蔽滑鼠右鍵、取消選取、防止複製、貼上、轉換位址列圖示
來源:http://www.cnblogs.com/aliang1992/p/6279291.html 1. oncontextmenu="window.event.returnValue=false" 將徹底遮蔽滑鼠右鍵 <table border oncont
網頁中最常用的JS程式碼(js禁止右鍵、禁止複製)
第一種也是簡單的新增事件: 【【<body oncopy="returnfalse"> 禁止複製 <input type=""name=""id=""value=""onpaste="returnfalse"/> 禁止貼上 <body