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
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts

    cannot correctly modify menu-switching script(s)

    after many failed attempts, i come to you a sad and broken man

    i've been trying to get one of the two following scripts to work, but so far to no avail. my goal is to have a user select an option from one menu on a form, and based on that selection, have the options in a second menu change to reflect options of their choice.
    i.e: first menu = company name
    second menu = products sold by THAT company.

    user selects company, the second menu changes to reflect the products of that company.

    i have found two script on this site that allows me to do that, but i cant get them working with my data.

    this script is preferable as it uses less actual code, but i have one small problem: http://www.js-examples.com/example/?ex=290&mode=2

    The problem is that if one company has 9 products, and another has 6, if the user selects the company with 6, it'll display 3 blank slots.
    if ANYONE knowws how to hide blank slots, that answers my question right there.
    i would have posted the code, but the link above contains it.

    the second script DOES hide blank slots, but the code is so complicated that i dont know how to actually edit it. and i only need 2 menus, and this one has 3: http://www.js-examples.com/example/?ex=458&mode=2

    if anyone can explain in baby steps where to put my own info.... that works too.

    lastly, if anyone has a simpler way to do this,... by all means

    thanks,
    -- Jay

    p.s, also, eventually i'm going to have to have an event occur depending on what the user chooses in the second menu... so if anyone knows how to do that then please add it
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Not too sure here but possibly something on these lines.




    [SIZE=1]
    <HTML><HEAD><TITLE>Populating Options</TITLE>
    <SCRIPT language=JavaScript type=text/JavaScript>
    <!--

    // select 2 option values
    var alpha_Array = new Array("Abacus","Abduct","Abided","Ablaze","Adapt");
    var bravo_Array = new Array("Babies","Backup","Baffle","Bakery");
    var charlie_Array = new Array("Cabled","Caches","Cactus");
    var delta_Array = new Array("Dabble","Dainty");

    function refill_select2(selected) {
    form_name=document.forms["feedback"]
    var selectedArray = eval(selected + "_Array");
    while (selectedArray.length < form_name.select2.options.length) {
    form_name.select2.options[(form_name.select2.options.length - 1)] = null;
    }
    for (var i=0; i < selectedArray.length; i++) {
    eval("form_name.select2.options[i]=" + "new Option('" + selectedArray[i]+"')");
    }
    }

    // End -->
    </SCRIPT>
    </HEAD>
    <BODY onload="refill_select2('alpha')"><h1>Populating options</h1>
    <center>
    <FORM name="feedback">

    <SELECT name="select1" onChange="refill_select2(this.form.select1.options[this.form.select1.selectedIndex].value)" size="1" style="width:100">
    <option value="alpha">Options A</option>
    <option value="bravo">Options B</option>
    <option value="charlie">Options C</option>
    <option value="delta">Options D</option>

    </SELECT>

    <SELECT name="select2" onChange="" size="1" style="width:100">
    <!-- option value=""><-----------</option -->
    </SELECT>
    </center>
    </BODY>
    </HTML>

    /SIZE]

  • #3
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    good stuff, lemme try to modify it & see how i do

    i may have newbie questions for you though

    seems to be working.

    how do i add an appostrophy? (')
    putting \' doesnt work...
    Last edited by canadianjameson; 07-14-2003 at 09:24 PM.
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #4
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts

    onSelect open Browser problem

    hello again. well, i got yesterdays dilema fixed thanks to Mr. J, now i need to take it a step further

    so, i got my menu selection thing working, NOW what i need to do is have a seperate event occur for EACH different choice the user chooses in the second menu. for an understanding of what i'm trying to do, please see here

    [thread reference redundent - previous thread is contained in this one]

    my problem is as follows: in the code provided in the above post (which worked, thx Mr. J), the values for the second menu are stored in arrays in the <head> section
    example:
    var options_Array = new Array("Option A","Option B","Option C");

    what i need to do is roughly have something like this occur:

    when "Option A" selected, popup optionsA_specs.html
    when "Option B" selected, popup optionsB_specs.html
    when "Option C" selected, popup optionsC_specs.html

    is this possible? i have seen it on other pages (i think)...
    anyways, let me know

    thanks,
    -- Jay
    Last edited by brothercake; 07-15-2003 at 11:01 PM.
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Please keep responses to a thread in the same thread; I've merged them together.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #6
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    ok brother, but do you think anyone will actually look at this now that its hidden as a response?

    heres the plan, i leave it here for 2 days, if no one responds i'll repost it anew. fair enough?
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)


  •  

    Posting Permissions

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