Click to See Complete Forum and Search --> : textarea to textarea using the getelementbyid method


lgk
03-12-2005, 03:19 PM
Need help tweaking this script to use textarea input instead of a dropbox.
Please and thanks to all replys

<html>
<head> <SCRIPT LANGUAGE="JScript">
val='';
function fnAdd(obj){
if (obj.selectedIndex<0||val.match(obj.options[obj.selectedIndex].value)){ return; }
val+=obj.options[obj.selectedIndex].value+'\n';
document.getElementById('fred').value=val;
}
</SCRIPT>

<title></title>
</head>

<body>


<SELECT ID=someText>
<OPTION VALUE="">some text</OPTION>
<OPTION VALUE="some text1">some text1</OPTION>
<OPTION VALUE="some text2">some text2</OPTION>
<OPTION VALUE="some text3">some text3</OPTION>

</SELECT>
<INPUT TYPE=button VALUE="Add To Textarea" onclick="fnAdd(document.getElementById('someText'));">

<textarea id="fred" rows="10" cols="20">

A1ien51
03-13-2005, 01:50 PM
With form elements you should use names with the form array, not id. It can be donw with the id.

document.formName.elementName1.value = document.formName.elementName2.value;

Eric