mat420 Posted May 14, 2008 Share Posted May 14, 2008 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/images/dropbox_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. Quote Link to comment Share on other sites More sharing options...
mat420 Posted May 14, 2008 Author Share Posted May 14, 2008 got it!! thanks people! <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> Quote Link to comment Share on other sites More sharing options...
mat420 Posted May 14, 2008 Author Share Posted May 14, 2008 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? Quote Link to comment Share on other sites More sharing options...
haku Posted May 14, 2008 Share Posted May 14, 2008 Unfortunately, you have to do the if-else statements. Welcome to the world of programming! Quote Link to comment Share on other sites More sharing options...
Xurion Posted May 15, 2008 Share Posted May 15, 2008 Use a case statement. <script type="text/javascript"> var red = 1; var result = null; switch (red) { case 1: result = 'one'; break; case 2: result = 'two'; break; default: result = 'unknown'; } document.write(result); </script> Quote Link to comment Share on other sites More sharing options...
haku Posted May 19, 2008 Share Posted May 19, 2008 Heh, my bad. And actually, that's a very good point! No need for all the if/else statements. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.