acerbic coffee
          走自己的路,讓別人跑步
          posts - 26,comments - 14,trackbacks - 0
          一、屏蔽鍵盤所有鍵

          <script language="javascript">
          <!--
          function document.onkeydown(){
          event.keyCode = 0;
          event.returnvalue = false;
          }
          -->
          </script>



          二、屏蔽鼠標右鍵

            在body標簽里加上oncontextmenu=self.event.returnvalue=false 或者:

          <script language="javascript">
          <!--
          function document.oncontextmenu()
          {
          return false;
          }
          -->
          </script>

          function nocontextmenu()
          {
          if(document.all) {
          event.cancelBubble=true;
          event.returnvalue=false;
          return false;
          }
          }


          或者:

          <body onmousedown="rclick()" oncontextmenu= "nocontextmenu()">

          <script language="javascript">
          <!--
          function rclick()
          {
          if(document.all) {
          if (event.button == 2){
          event.returnvalue=false;
          }
          }
          }
          -->
          </script>



          三、屏蔽 Ctrl+N、Shift+F10、F5刷新、退格鍵

          <script language="javascript">
          <!--
          //屏蔽鼠標右鍵、Ctrl+N、Shift+F10、F5刷新、退格鍵
          function window.onhelp(){return false} //屏蔽F1幫助
          function KeyDown(){
          if ((window.event.altKey)&&
          ((window.event.keyCode==37)|| //屏蔽 Alt+ 方向鍵 ←
          (window.event.keyCode==39))){ //屏蔽 Alt+ 方向鍵 →
          alert("不準你使用ALT+方向鍵前進或后退網頁!");
          event.returnvalue=false;
          }


          注:這還不是真正地屏蔽 Alt+ 方向鍵,因為 Alt+ 方向鍵彈出警告框時,按住 Alt 鍵不放,用鼠標點掉警告框,這種屏蔽方法就失效了。

          if ((event.keyCode == 8) &&
          (event.srcElement.type != "text" &&
          event.srcElement.type != "textarea" &&
          event.srcElement.type != "password") || //屏蔽退格刪除鍵
          (event.keyCode==116)|| //屏蔽 F5 刷新鍵
          (event.ctrlKey && event.keyCode==82)){ //Ctrl + R
          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;
          if (window.event.srcElement.tagName == "A" && window.event.shiftKey)

          window.event.returnvalue = false; //屏蔽 shift 加鼠標左鍵新開一網頁
          if ((window.event.altKey)&&(window.event.keyCode==115)){ //屏蔽Alt+F4
          window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px");
          return false;}
          }


            另外可以用 window.open 的方法屏蔽 IE 的所有菜單
            第一種方法:

          window.open("你的.htm", "","toolbar=no,location=no,directories=no,menubar=no,

          scrollbars=no,resizable=yes,status=no,top=0,left=0")


            第二種方法是打開一個全屏的頁面:

          window.open("你的.asp", "", "fullscreen=yes")
          */
          //-->
          </script>

          四、屏蔽瀏覽器右上角“最小化”“最大化”“關閉”鍵

          <script language=javascript>
          function window.onbeforeunload()
          {
          if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
          {
          window.event.returnvalue = "";
          }
          }
          </script>


            或者使用全屏打開頁面

          <script language="javascript">
          <!--
          window.open(www.32pic.com,"32pic","fullscreen=3,height=100, width=400,
          top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no,
          status=no");
          -->
          </script>


            注:在body標簽里加上

          onbeforeunload="javascript:return false"http://使不能關閉窗口



          五、屏蔽F5鍵

          <script language="javascript">
          <!--
          function document.onkeydown()
          {
          if ( event.keyCode==116)
          {
          event.keyCode = 0;
          event.cancelBubble = true;
          return false;
          }
          }
          -->
          </script>



          六、屏蔽IE后退按鈕
            在你鏈接的時候用

          <a href="javascript:location.replace(url)">



          七、屏蔽主窗口滾動條
            在body標簽里加上

          style="overflow-y:hidden"



          八、屏蔽拷屏,不斷地清空剪貼板
            在body標簽里加上

          onload="setInterval('clipboardData.setData(\'Text\',\'\')',100)"



          九、屏蔽網站的打印功能

          <style>
          @media print {
          * { display: none }
          }
          </style>



          十、屏蔽IE6.0 圖片上自動出現的保存圖標
            方法一:

          <META HTTP-EQUIV="imagetoolbar" CONTENT="no">


            方法二:

          <img galleryimg="no">



          十一、屏蔽頁中所有的script
          ?

          function langedit(event) {
          ?if(document.selection){
          ??var selectText = "";
          ??if(document.selection && document.selection.createRange().text.length>0){
          ???selectText = document.selection.createRange().text;
          ??}else{
          ???selectText = window.event.srcElement.innerText;
          ??}
          ??window.open("<%=request.getContextPath()%>/langinfo.jsp?nSelectText="+selectText+"&filename="+document.location.pathname,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=500");
          ?}else{
          ??//alert(event.target.tagName);alert(event.target.nodeName);
          ??if(window.getSelection()!=''){
          ???window.open("<%=request.getContextPath()%>/langinfo.jsp?nSelectText="+window.getSelection()+"&filename="+document.location.pathname,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=500");
          ??}
          ?}
          ?
          }

          if(navigator.userAgent.indexOf("MSIE")>0){
          ?document.oncontextmenu=function(){if(event.ctrlKey){langedit();return false;} }
          }else{
          ?document.oncontextmenu=function(event){if(event.ctrlKey){langedit(event);return false;} }
          }

          posted on 2006-10-22 10:57 acerbic coffee 閱讀(588) 評論(0)  編輯  收藏 所屬分類: 個人記錄
          主站蜘蛛池模板: 即墨市| 巴彦淖尔市| 集安市| 乌兰县| 南召县| 应城市| 新蔡县| 武宁县| 珲春市| 和林格尔县| 商都县| 河曲县| 淳化县| 大渡口区| 临夏市| 永丰县| 沽源县| 阿坝县| 中超| 政和县| 江达县| 岳西县| 上林县| 繁峙县| 云和县| 新丰县| 剑阁县| 清水县| 秦皇岛市| 连云港市| 丘北县| 温宿县| 任丘市| 禄劝| 西贡区| 扶风县| 丹寨县| 秭归县| 虹口区| 绿春县| 莱阳市|