Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how can i select items from select box

    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

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,960
    Thanks
    0
    Thanked 236 Times in 233 Posts
    Can you select multiple items in each of the 2 comboboxes? It's better that you post the related html codes.

  • #3
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hi..posting HTML Content

    Code:
    <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>
    Last edited by liorean; 06-08-2004 at 10:22 AM. Reason: [code]ified

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,960
    Thanks
    0
    Thanked 236 Times in 233 Posts
    Code:
    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)" />

  • #5
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    hi..

    How can i delete it from the lists once i add into 3rd list...is there any method like delete or remove

    chintan

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,960
    Thanks
    0
    Thanked 236 Times in 233 Posts
    Code:
    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)" />


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •