...

View Full Version : copy text from one area to another



tsclan
06-25-2004, 06:39 PM
Is there a way of copying text from one textarea to another via a list box
eg
1. Have a textarea where somone has written text in
2. Then an option to put the same text above into a textarea below
3. So that if yes is selected the same text in now in textarea 2

is something like that possible?
thanks

adios
06-25-2004, 07:59 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>untitled</title>
</head>
<body>
<form>
<h3>Textarea 1</h3>
<textarea name="TA1"></textarea>
<p>
<strong>Transfer text from <tt>Textarea 1</tt> to <tt>Textarea 2</tt>?</strong>
<select onchange="eval('TA2.value='+options[selectedIndex].value)">
<option value="TA2.value" selected="selected">-choose-</option>
<option value="TA1.value"> yes </option>
<option value="TA2.value||''"> no </option>
</select>
</p>
<h3>Textarea 2</h3>
<textarea name="TA2"></textarea>
</form>
</body>
</html>

tsclan
06-25-2004, 10:28 PM
thank you very much

glenngv
06-28-2004, 10:36 AM
Ohh, eval again. :rolleyes:
That can be implemented without eval.


<select onchange="this.form.TA2.value=(this.selectedIndex==0)?this.form.TA1.value:''">
<option> yes </option>
<option selected="selected"> no </option>
</select>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum