Batfinks Copy Code

[Total: 0    Average: 0/5]

This will copy the words from the textbox to the page, or the other way.

Head Code:

<script language="javascript">
function doIt(act)
{
  if(act=='t')
  {
   var reg=/n/g;
   var x=document.fm.ta.value;
   y=x.replace(reg,"<BR />");
   document.getElementById("target").innerHTML=y;
  }
  else
  {
    var z = document.getElementById("target").innerHTML;
    var regNL = (navigator.appVersion.lastIndexOf('Win') != -1) ? "rn" : "n"
    document.fm.ta.value= z.replace(/<BR />/gi, regNL);
  }
}
</script>

Body Code:

<table>
<tr><td id="target">target text here</td></tr>
</table>
<HR>
<form name="fm">
<textarea name="ta" id="ta1" cols="80" rows="5">
This
Is
my line of
text

</textarea><BR />
<input type=button value="From textarea to TD" onclick="doIt('t')">
<input type=button value="From TD to textarea" onclick="doIt('f')">
</form>

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *