codefans

          導(dǎo)航

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

          統(tǒng)計(jì)

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          程序設(shè)計(jì)鏈接

          搜索

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          一些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,''))">

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

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

          關(guān)閉父窗口(無提示)
          <script>
          opener="";
          window.open().document.write("<input value='關(guān)閉父窗口' 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=關(guān)閉所有>
          <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=頁(yè)面設(shè)置>
          <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=關(guān)閉>

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

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


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

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

          評(píng)論

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

          erre  回復(fù)  更多評(píng)論   


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 会同县| 泰宁县| 双辽市| 玉山县| 庆安县| 五寨县| 莫力| 宁都县| 建宁县| 尼木县| 新兴县| 双柏县| 习水县| 福贡县| 达州市| 沙坪坝区| 新营市| 台安县| 托里县| 漠河县| 上饶市| 胶南市| 临漳县| 多伦县| 高邑县| 百色市| 平原县| 湘西| 封开县| 青冈县| 冕宁县| 南涧| 贺州市| 安塞县| 龙岩市| 青铜峡市| 潢川县| 昭平县| 武隆县| 丹凤县| 西藏|