View Full Version : copy text from one area to another

06-25-2004, 05:39 PM
Is there a way of copying text from one textarea to another via a list box
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?

06-25-2004, 06:59 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"

<h3>Textarea 1</h3>
<textarea name="TA1"></textarea>
<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>
<h3>Textarea 2</h3>
<textarea name="TA2"></textarea>

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

06-28-2004, 09: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>

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum