View Full Version : Any Expert? please help me Out!!

01-14-2003, 06:27 AM
This is passing values from one ListBox to another ListBox....

What Im trying to do is to leave the left ListBox and make the right one a Textarea, so that I could pass any of the ListBox values on to the textarea Without replacing whatever text I have already on the Textarea

If you get this one your The Best!!!

<script language="JavaScript">

function addSrcToDestList() {destList = window.document.forms[0].destList;srcList = window.document.forms[0].srcList; var len = destList.length;for(var i = 0; i < srcList.length; i++) {if ((srcList.options[i] != null) && (srcList.options[i].selected)) {

var found = false;for(var count = 0; count < len; count++) {if (destList != null) {if (srcList.options[i].text == destList.text) {}}}if (found != true) {destList[len] = new Option(srcList.options[i].text);


<form method="POST">
<select size="5" name="srcList">
<option value="1">Item 1<option value="1">Item 2</select>
<input type="button" value=" > " onClick="javascript:addSrcToDestList()">
<select size="5" name="destList">
</form></body></html> :confused:

01-14-2003, 04:31 PM
A textarea? Or another select element? Because the code you posted has another select element.

Which is it supposed to be?

01-14-2003, 04:34 PM
Is this what you're trying to do? It appends the select box value to the textarea.

<form name="myform">
<select onchange="document.myform.my_ta.value += document.myform.my_sl[document.myform.my_sl.selectedIndex].text" name="my_sl">

<textarea name="my_ta">my text area</textarea>

01-14-2003, 10:58 PM
thank you very much!!!!!