codefans

          導航

          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          統計

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          程序設計鏈接

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          一些javascript腳本

          只能輸入漢字
          <input onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\u4E00-\u9FA5]/g,''))">


          只能輸入全角
          <input onkeyup="value=value.replace(/[^\uFF00-\uFFFF]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\uFF00-\uFFFF]/g,''))">

          只能輸入數字
          <input onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">

          只能輸入英文和數字
          <input onkeyup="value=value.replace(/[\W]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">

          關閉父窗口(無提示)
          <script>
          opener="";
          window.open().document.write("<input value='關閉父窗口' type='button' onclick='opener.window.close()'>");
          </script>

          讓表格半透明
          <body bgcolor="red">
          This is body!
          <div style="position:absolute;background:black;filter:Alpha(Opacity=50);color:white;height:300;top:0;left:0">This is layer!</div>
          </body>

          <body style="filter:Alpha(Opacity=50)">
          <iframe width="100%" height="100%" src="
          http://sina.com.cn
          ">


          <OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
          <input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打開>
          <input name=Button onClick=document.all.WebBrowser.ExecWB(2,1) type=button value=關閉所有>
          <input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存為>
          <input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印>
          <input name=Button onClick=document.all.WebBrowser.ExecWB(6,6) type=button value=直接打印>
          <input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=頁面設置>
          <input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=屬性>
          <input name=Button onClick=document.all.WebBrowser.ExecWB(17,1) type=button value=全選>
          <input name=Button onClick=document.all.WebBrowser.ExecWB(22,1) type=button value=刷新>
          <input name=Button onClick=document.all.WebBrowser.ExecWB(45,1) type=button value=關閉>

          屏蔽 JS 錯誤
          function killErrors() { return true; }
          window.onerror = killErrors; dd

          只在關閉窗口的時候提示,刷新的時候不提示
          if(event.clientX>document.body.clientWidth)alert("你沒有刷新就關閉了?");


          控制Iframe頁面的前進與后退
          window.frames["frameName"].history.back();
          window.frames["frameName"].history.forward();

          posted on 2006-02-25 11:12 春雷的博客 閱讀(309) 評論(1)  編輯  收藏

          評論

          # re: 一些javascript腳本 2006-05-26 14:02 ererr

          erre  回復  更多評論   


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 荣成市| 汕头市| 东阿县| 昭苏县| 谢通门县| 新田县| 区。| 贡山| 安泽县| 许昌市| 茶陵县| 灵山县| 上思县| 新蔡县| 通河县| 黄山市| 延庆县| 贵德县| 资兴市| 上饶市| 辽阳市| 石棉县| 邵阳市| 岳西县| 同德县| 兰考县| 彰化县| 舟山市| 荃湾区| 三门县| 黄平县| 台东县| 无锡市| 巨野县| 三原县| 大姚县| 湟中县| 万源市| 富锦市| 兖州市| 石棉县|