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 7 of 7
  1. #1
    New Coder
    Join Date
    May 2008
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Easy question about drop down menu/drop box

    I need help with a drop box. Not a button that opens sub menus but I need a drop box like this...here the drop box is dropped down
    http://irt.austincc.edu/blackboard/i...opbox_send.gif

    the ones where u click the little arrow on the right and more options come down


    now i know how to create one of those but, how do u make it so, if drop box 1 says "size 1" and drop box 2 says "color:blue" it goes to one link

    but if one drop box says "size 1" and the other says "color:green" it goes to another link? thanks so much guys.

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Location
    AZ, USA
    Posts
    685
    Thanks
    6
    Thanked 46 Times in 46 Posts
    The basic idea:

    Code:
    <form name="myform"><select name="obj1"><option>blah</option></select><select name="obj2"><option>blah blah</option></select><input type="button" value="Go" onClick="go(document.myform.obj1.value,document.myform.obj2.value)"></form>
    
    <script>
    function go(obj1, obj2)
    {
    if(obj1=="blah" && obj2=="blah blah") alert("Hello world");
    }
    </script>
    A similar effect is the "Double Drop-Down Menu" effect. In that type, when you select an option in the first select box, the options in the second one change. If your interested in that Google "Double Drop-Down Menu".
    Last edited by binaryWeapon; 05-14-2008 at 05:44 AM. Reason: Confused w/ double drop-down

  • #3
    New Coder
    Join Date
    May 2008
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks so much
    i suck at html so it wasnt easy to fix

    i had to make it:

    <form name="myform"><select name="obj1"><option>blah</option></select><select name="obj2"><option>blah

    blah</option></select><input type="button" value="Go"

    onClick="go(document.myform.obj1.value,document.myform.obj2.value)"></form>
    <script type="text/javascript">

    function go(obj1, obj2)
    {
    if(obj1=="blah" && obj2=="blah blah") alert("Hello world");
    }
    </script>


    to work. i guess the script type is what did it? i suck really bad..

    now what can i change alert("hello"); to, to make it visit a link please? thank u so so so so much man.

  • #4
    New Coder
    Join Date
    May 2008
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    got it!!!!! thanks so much man u saved me alot of stress.
    aim screenname: mcg if u ever need anything
    <html>
    <body>


    <form name="myform"><select name="obj1"><option>blah</option></select><select name="obj2"><option>blah

    blah</option></select><input type="button" value="Go"

    onClick="go(document.myform.obj1.value,document.myform.obj2.value)"></form>
    <script type="text/javascript">

    function go(obj1, obj2)
    {
    if(obj1=="blah" && obj2=="blah blah") document.location.href="http://www.go.com";
    }
    </script>

  • #5
    Regular Coder
    Join Date
    Sep 2007
    Location
    AZ, USA
    Posts
    685
    Thanks
    6
    Thanked 46 Times in 46 Posts
    Glad to help!

  • #6
    New Coder
    Join Date
    May 2008
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    maybe not. this works but..its for a site that sells brochures, these brochures have many different options


    if i do an "if this do that" for every option, itll take forever and get confusing. what else can i do?


    these broshires have say, 3 dif thicknesses, then 3 different fold options, 3 different color options and say ...3 different size options. what can i do to make this easier?

  • #7
    Regular Coder
    Join Date
    Sep 2007
    Location
    AZ, USA
    Posts
    685
    Thanks
    6
    Thanked 46 Times in 46 Posts
    TBH, I don't really know of a better solution. You're going to have to type out 81 or so if-then statements, if you have different links for each combination. A possible solution would be to give a series of pages names that correspond to a combination of options selected. For example, if you selected: "medium","trifold","green","large", as the options for thicknesses, fold options, colors and sizes, then it would take you to a page called "mediumtrifoldgreenlarge.html"... in this situation you would now have to make 81 html pages. The thing I would do would be to have a php page that would take 4 _GET vars in the url. You would then set up a (java)script like:
    Code:
    document.location="phppage.php?thickness="+obj1+"&fold="+obj2+"&color="+obj3+"&size="+obj4;
    So looking back, it would appear that unless you can pass the values right to the shopping cart or whatever you're using, you will have to have 81 of something. It depends on your situation and what you can work with.


  •  

    Posting Permissions

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