Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<script type="text/javascript">
/*<![CDATA[*/
function Text(from,to){
if (document.getElementById(from).value) document.getElementById(to).value=document.getElementById(from).value;
}
/*]]>*/
</script></head>
<body>
<select id="select">
<option value="Text 1" >option 1</option>
<option value="Text 2">option 2</option>
</select>
<br><br><br>
<input type="button" value="Generate" onclick="Text('select','ta')"><br>
<textarea id="ta" cols=10 rows=5></textarea>
</body>
</html>
or
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<script type="text/javascript">
/*<![CDATA[*/
var Ary=[];
Ary[0]='Text One';
Ary[1]='Text Two';
function Text(from,to,ary){
var index=document.getElementById(from).selectedIndex;
if (ary[index]) document.getElementById(to).value=ary[index];
}
/*]]>*/
</script></head>
<body>
<select id="select">
<option>option 1</option>
<option>option 2</option>
</select>
<br><br><br>
<input type="button" value="Generate" onclick="Text('select','ta',Ary)"><br>
<textarea id="ta" cols=10 rows=5></textarea>
</body>
</html>
Bookmarks