...

View Full Version : how can i select items from select box



chintan34
06-08-2004, 09:56 AM
Hi...
I want to add selected items from 2 list boxes to 3rd one..? how can i do that...as i do not know anything of JavaScript...The basic question is how can i get values of selected items of list box in array?

Please it is very urgent

Thanks

Regards
Chintan

glenngv
06-08-2004, 10:02 AM
Can you select multiple items in each of the 2 comboboxes? It's better that you post the related html codes.

chintan34
06-08-2004, 10:15 AM
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<link rel="Stylesheet" type="text/css" href="Style/ss.css">
<title>Sunday Team Generation</title>
</script>
</head>
<body>

<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p>
<div align="center">
<center>
<table border="0" cellpadding="3" cellspacing="1" width="370" height="24">
<tr>
<td width="370" height="24">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
CBAY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
PRECYSE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DTS</td>
</tr>
</table>
</center>
</div>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<p align="left">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<SELECT NAME="CBAY" MULTIPLE SIZE=9>
<OPTION VALUE="1-15">Chintan
<OPTION VALUE="16-21">Test
<OPTION VALUE="22-30">Rohit
<OPTION VALUE="31-45">
<OPTION VALUE="46-65">
<OPTION VALUE="66-80">
<OPTION VALUE="81-up">
</SELECT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<SELECT NAME="D1" MULTIPLE SIZE=9>
<OPTION VALUE="1-15">Chintan
<OPTION VALUE="16-21">Test
<OPTION VALUE="22-30">Rohit
<OPTION VALUE="31-45">
<OPTION VALUE="46-65">
<OPTION VALUE="66-80">
<OPTION VALUE="81-up">
</SELECT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<SELECT NAME="D2" MULTIPLE SIZE=9>
<OPTION VALUE="1-15">Chintan
<OPTION VALUE="16-21">Test
<OPTION VALUE="22-30">Rohit
<OPTION VALUE="31-45">
<OPTION VALUE="46-65">
<OPTION VALUE="66-80">
<OPTION VALUE="81-up">
</SELECT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p align="left">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="ADD" name="B3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="ADD" name="B4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="ADD" name="B5">
<p align="center">
<SELECT NAME="D3" MULTIPLE SIZE=9>
<OPTION VALUE="1-15">
<OPTION VALUE="16-21">
<OPTION VALUE="22-30">
<OPTION VALUE="31-45">
<OPTION VALUE="46-65">
<OPTION VALUE="66-80">
<OPTION VALUE="81-up">
</SELECT>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<p align="center"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

</body>

</html>

glenngv
06-08-2004, 10:33 AM
function addOptions(objSrc, objDest){ //source select object, destination select object
for (var i=0;i<objSrc.options.length;i++){
if (objSrc.options[i].selected){
objDest.options[objDest.options.length] = new Option(objSrc.option[i].text, objSrc.option[i].value);
}
}
}
...
<input type="button" value="ADD" name="B3" onclick="addOptions(this.form.CBAY, this.form.D3)" />
<input type="button" value="ADD" name="B4" onclick="addOptions(this.form.D1, this.form.D3)" />
<input type="button" value="ADD" name="B5" onclick="addOptions(this.form.D2, this.form.D3)" />

chintan34
06-08-2004, 12:08 PM
How can i delete it from the lists once i add into 3rd list...is there any method like delete or remove

chintan

glenngv
06-09-2004, 03:30 AM
function deleteOptions(objTarget){
for (var i=objTarget.options.length-1;i>=0;i--){
if (objTarget.options[i].selected){
objTarget.options[i] = null;
}
}
}
...
<input type="button" value="Delete" onclick="deleteOptions(this.form.D3)" />



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum