隨筆-16  評論-8  文章-30  trackbacks-0
          表單提交時(shí)自動(dòng)復(fù)制到剪貼板

          為了這小東西,搞了半天.網(wǎng)易的bulo(http://bulo.163.com/article/-0rbj-N_pZux.html)雖然也有這功能,但我提取不出來.郁悶.最后還是自己寫出來的.JS要補(bǔ)習(xí)了

          這功能雖然非常小,但有時(shí)候卻非常有用.

          估計(jì)你也有過這種經(jīng)歷:長篇大論后提交,發(fā)現(xiàn)"該頁無法顯示",或者"登錄超時(shí)"...

          然后,你不得不捶桌子?哈哈

          如何在頁面里加入,就看你自己的了,會html的都會的

          演示:


          提交時(shí)復(fù)制內(nèi)容到剪貼板

           代碼如下:


          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
          <title>交時(shí)自動(dòng)復(fù)制到剪貼板</title>
          </head>

          <script language="JavaScript">
          /*功能:提交時(shí)自動(dòng)復(fù)制到剪貼板 */

          function copyText(obj) {
          ie = (document.all)? true:false
          if (ie){
          var rng = document.body.createTextRange();
          rng.moveToElementText(obj);
          rng.scrollIntoView();
          rng.select();
          rng.execCommand("Copy");
          rng.collapse(false);
          }
          }

          function autocopy() {
           if (this.document.formname.isautocopy.checked) {
           copyText(this.document.formname.icontent);
           }
          }
          </script>

          <body>
          <form action=""  method="post" name="formname" onsubmit="autocopy();">
          <textarea name="icontent" rows="4" cols="50"></textarea><br>
          <input name="isautocopy" checked="checked" value="1" type="checkbox" />
          提交時(shí)復(fù)制內(nèi)容到剪貼板<br/><input type="submit" value="提交" /> </form>

          </body>
          </html>

          (轉(zhuǎn)載自phpv.net)
          posted on 2005-06-13 17:03 楚客 閱讀(897) 評論(1)  編輯  收藏 所屬分類: 轉(zhuǎn)載

          評論:
          # re: 表單提交時(shí)自動(dòng)復(fù)制內(nèi)容到剪貼板[未登錄] 2012-09-04 13:48 | 123
          土寺  回復(fù)  更多評論
            
          主站蜘蛛池模板: 阳朔县| 昆山市| 平度市| 中超| 湄潭县| 曲阳县| 蕉岭县| 交口县| 明光市| 衡阳市| 永昌县| 广平县| 安仁县| 琼海市| 化州市| 鄢陵县| 长葛市| 资溪县| 塘沽区| 页游| 游戏| 大英县| 沂南县| 闻喜县| 延长县| 芦溪县| 澳门| 皮山县| 靖边县| 和田市| 卫辉市| 刚察县| 双牌县| 奎屯市| 厦门市| 西昌市| 临沧市| 岑巩县| 新竹市| 阳泉市| 新沂市|