熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

按鈕完成復制和剪切功能

2013-11-15 11:59:34  來源: JSP教程 

  <SCRIPT language=JavaScript>

function copy(ob){ var obj=findObj(ob); if (obj) {  objselect();js=objcreateTextRange();jsexecCommand("Copy");} } function cut(ob){ var obj=findObj(ob); if (obj) {  objselect();js=objcreateTextRange();jsexecCommand("Cut");} } function findObj(n d) { //v   var pix;  if(!d) d=document; if((p=nindexOf("?"))>&&parentframeslength) {     d=parentframes[nsubstring(p+)]document; n=nsubstring(p);}   if(!(x=d[n])&&dall) x=dall[n]; for (i=;!x&&i<dformslength;i++) x=dforms[i][n];   for(i=;!x&&dlayers&&i<dlayerslength;i++) x=findObj(ndlayers[i]document);   if(!x && documentgetElementById) x=documentgetElementById(n); return x; } //> </SCRIPT> <input type="button" name="Button" value="復制到剪貼板" onClick=copy(txtOutput)> <input type="button" name="Button" value="剪貼到剪貼板" onClick=cut(txtOutput)>     <br><form name="fom" method="post" action="">     <textarea name="txtOutput" rows="" cols=""> dfkghkldfghklsdjfhgklsdfhgklhsdfklghsdfklhj
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20042.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.