codefans

          導航

          <2006年5月>
          30123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          統計

          常用鏈接

          留言簿(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 春雷的博客 閱讀(308) 評論(1)  編輯  收藏

          評論

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

          erre  回復  更多評論   


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


          網站導航:
           
          主站蜘蛛池模板: 东台市| 大埔县| 出国| 麟游县| 天津市| 天峻县| 文昌市| 棋牌| 泸溪县| 安多县| 舒兰市| 长垣县| 上栗县| 丹阳市| 望奎县| 海淀区| 海原县| 保山市| 上饶市| 五大连池市| 济源市| 和林格尔县| 成安县| 佛教| 灵川县| 湘阴县| 藁城市| 聊城市| 建湖县| 陆川县| 灵石县| 大埔县| 潼关县| 裕民县| 长子县| 辉南县| 兴化市| 九江市| 永和县| 博白县| 乐平市|