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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Fighting the arrays

    Hi there
    Iíve got two <select>-boxes. The second box changes options according to the first <select>. This works fine, but how do I attach values, in this case URLís, to the second <select>? Normally this wouldnít be a problem, but since this script works with arrays it confuses me.
    I found the script on the internet.

    Check out 'my' script

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    197
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Its not really clear what you are asking for....
    maybe try something like this..

    <SCRIPT LANGUAGE="JavaScript">
    <!--//
    function addOption(){
    temp =new Array()
    for (a=0; a<document.f.s.options.length; a++){
    temp[a] = document.f.s.options[a].text
    }
    temp[temp.length]= document.f.t.value
    for (b=0; b<temp.length; b++){
    document.f.s.options[b]=new Option(temp[b])
    }
    document.f.s.selectedIndex=0
    }
    //-->
    </SCRIPT>
    <FORM NAME=f>
    <INPUT TYPE=text name=t>
    <INPUT TYPE=button onclick=addOption() value="add option >>">
    <SELECT NAME=s>
    <OPTION>Hello
    <OPTION>HI
    <OPTION>Bye
    </SELECT>

    </FORM>
    ez
    hope its helpful
    Last edited by ez4ne12c; 04-10-2003 at 09:50 PM.
    Animation Rule #64
    Poor quality images are often artistic,
    Poor quality sound is ALWAYS annoying.

  • #3
    New to the CF scene
    Join Date
    Apr 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, but not exactly what I was looking for - or perhaps I'm missing out on something here?
    Check out my form: http://larsliin.dk/test.htm

    When I choose one of the options in the right box, I need to go to an URL. I need to attach values to the options. This is difficult since the right box works with arrays. How can this be solved?


  •  

    Posting Permissions

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