...

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



chapimp
01-14-2003, 05: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!!!



<html><head>
<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);
len++;}}}}

</SCRIPT></head><body>

<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">
</select>
</form></body></html> :confused:

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

Which is it supposed to be?

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



<html>
<body>
<form name="myform">
<select onchange="document.myform.my_ta.value += document.myform.my_sl[document.myform.my_sl.selectedIndex].text" name="my_sl">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum