js常用代碼

          1.?oncontextmenu="window.event.returnValue=false"?將徹底屏蔽鼠標右鍵特效
          <table?border?oncontextmenu=return(false)><td>no</table>?可用于Table?

          2.?<body?onselectstart="return?false">?取消選取、防止復制?javascript技巧

          3.?onpaste="return?false"?不準粘貼技巧

          4.?oncopy="return?false;"?oncut="return?false;"?防止復制的javascirpt特效

          5.<noscript>// 禁止另存為
          ??????<iframe src="*.htm"></iframe>
          ???</noscript>

          功能:禁止右鍵、禁選擇、禁粘貼、禁shift、禁ctrl、禁alt

          <script?language="JavaScript">
          <!--
          function?key(){?
          ???//禁止Shift
          ???if(event.shiftKey){
          ??????window.close();
          ???}
          ???//禁止Alt
          ???if(event.altKey){
          ??????window.close();
          ???}
          ???//禁止Ctrl
          ???if(event.ctrlKey){
          ??????window.close();
          ???}

          ???return?false;
          }

          document.onkeydown=key;

          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>

          <body?onselectstart="return?false";?onpaste="return?false";>?


          在JSP標準的語法中,如果pageEncoding屬性存在,那么JSP頁面的字符編碼方式就由pageEncoding決定,否則就由contentType屬性中的charset決定,如果charset也不存在,JSP頁面的字符編碼方式就采用默認的ISO-8859-1。

          //添加到收藏夾??
          function AddToFavorite()??
          {??
          ????if (document.all){??
          ?????? window.external.addFavorite(document.URL,document.title);??
          ????}else if (window.sidebar){??
          ?????? window.sidebar.addPanel(document.title, document.URL, "");??
          ????}??
          }??
          ??
          //設為首頁??
          function setHomepage(){??
          ????if (document.all){??
          ????document.body.style.behavior='url(#default#homepage)';??
          ????document.body.setHomePage(document.URL);??
          ??}else if (window.sidebar){??
          ????????if(window.netscape){??
          ?????? try{????
          ??????????netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");????
          ?????? }catch (e){????
          ????????????????????alert( "該操作被瀏覽器拒絕,如果想啟用該功能,請在地址欄內輸入 about:config,然后將項 signed.applets.codebase_principal_support 值該為true" );????
          ?????? }??
          ????????}????
          ????var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);??
          ????prefs.setCharPref('browser.startup.homepage',document.URL);??
          ????}??
          }

          posted on 2010-03-09 11:07 飛熊 閱讀(232) 評論(0)  編輯  收藏 所屬分類: javaScript

          <2010年3月>
          28123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          導航

          統計

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          收藏夾

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 泸定县| 建水县| 凉城县| 宜城市| 台州市| 麻阳| 郧西县| 房产| 平湖市| 徐州市| 江阴市| 辽中县| 定陶县| 平阴县| 东辽县| 吴桥县| 高阳县| 繁昌县| 太仆寺旗| 珲春市| 凉城县| 桐梓县| 肇源县| 磴口县| 山阳县| 梁山县| 改则县| 梅州市| 游戏| 汝州市| 房山区| 临泉县| 县级市| 克拉玛依市| 杂多县| 乌苏市| 安庆市| 霍山县| 阜阳市| 莱州市| 昆山市|