how do you select subcats on the fly?

Discussion in 'JavaScript' started by jnm, Sep 17, 2006.

  1. #1
    jnm, Sep 17, 2006 IP
  2. VONRAT

    VONRAT Banned

    Messages:
    181
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I looks like it's using the Ajax Technology or something similar to it :)

    Search the web for Ajax tutorials but if you're already familiar to it then all you need are callback functions ( javascript ) that will display the next object for you and hide the previous one. :D
     
    VONRAT, Sep 17, 2006 IP
  3. BurgerKing

    BurgerKing Active Member

    Messages:
    397
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    58
    #3
    AJAX is not being used on this page.

    All that is happening is that an event is being fired (onChange) when you make a selection from the combo box.

    Here is the code that they are using:
    onChange="getResults(this.value,'results.asp','')"

    This calls the function getResults, passing in the value that you have just chosen, as well as a url.

    This is the code they are using for getResults:
    function getResults(o, p, e){

    if (o != ""){
    eval(e);
    document.f1.action = p;
    document.f1.submit();
    }
    else window.alert("Please make another selection");

    }

    All this function does is checks to see that you have chosen something in the combo, and then submits the form to the specified url.

    On the SERVER-SIDE there will be processing that evaluates what you chose in the combo box, rebuilds the page, and then posts it back to you.

    It sounds like you want a 2 level javascript combo script. If that is the case, check this out:
    http://www.javascriptkit.com/script/script2/2levelcombo.shtml

    Cheers.
     
    BurgerKing, Sep 18, 2006 IP