Oops...may be I did not make it clear enough.
Here is how it looks:
TO TEST JAVASCRIPT TO SELECT FROM A SELECT LIST AND COPY TO A DESIRED TEXT AREA
<hr>
<form name="myform" method=post >
<strong> firstbox </strong>
<SELECT MULTIPLE size = "4" NAME="firstbox" onchange="CopySelected(firstbox)">
<OPTION> Sun
<OPTION> Silicon Graphics
<OPTION> Intel
<OPTION> Motorola
<OPTION> TI
<OPTION> BMW
<OPTION> Ferrari
</SELECT>
<strong> secondbox </strong>
<SELECT MULTIPLE size = "4" NAME="secondbox" onChange="CopySelected(secondbox)">
<OPTION> USA
<OPTION> UK
<OPTION> China
<OPTION> Malasiya
<OPTION> Singapore
<OPTION> Indonesia
</SELECT>
<hr>
X-Expression
<TEXTAREA NAME="xexpression" ROWS="4" COLS="20" onFocus="get_area_name(xexpression)">
</TEXTAREA>
<br>
Y-Expression
<TEXTAREA NAME="yexpression" ROWS="4" COLS="20" onFocus="get_area_name(yexpression)">
</TEXTAREA>
<hr>
<SCRIPT LANGUAGE="JavaScript">
var t;
function get_area_name(object) {
t = object.name;
// When user clicks in text area, I want to
//store the name of the box so that next time
// user clicks in select box, selected text
// is copied to this text area
}
function CopySelected(object){
// This java script function should select
// the selected text from the select
// menu and copy to the text area that
// user had clicked before (stored in t)
t.value = t.value + object.options[object.selectedIndex].value;
}
</SCRIPT>
</form>
</BODY>
I can copy selected text to a specific
text area (not this code), but I want to "memorize" user clicked text area and then
copy to THAT text area.
This is why I declared "t" as global variable here, but in vain 🙁