...

View Full Version : Drop down menu, launch new page



bradyj
06-25-2004, 08:56 PM
I have a basic drop down menu with the options:


<option>Single Family</option>
<option>Two Family</option>
<option>Multi-Family</option>
<option value="vacant.php">Vacant Land</option>
<option>Condominium</option>
<option value="commercial.php">Commercial</option>
<option>Investment</option>


As soon as someone selects 'Vacant Land' or 'Commercial', I want them to be automatically redirected to that form, without having to select a 'go' button, since these users may not be that adept. I imagine this is rather easy via Javascript, but that's not my cup of tea:) Any ideas?

...or, maybe it would be best to do this, if you guys know of a way? EssentiallyThe Site Link example (http://www.igotyourhouse.com/test/buyer.php), when people select vacant land or commercial; some of the areas that have bedrooms, bathrooms, garage, etc. are ilrelevant -- originally, I was going to have javascript send you to a new page when you select one of those from the drop down menu... but maybe I am not thinking this clearly? Maybe I should swap out those td's with other td's of the relevant information... can javascript do this? Or should I look at PHP or some other scripting language?

adios
06-25-2004, 09:07 PM
You omitted the values of the other options, making this less obvious...I'm guessing they're the same as the text string, so:


<select onchange="v=options[selectedIndex].value;if(/\.php$/i.test(v))self.location=v">
<option value="">- choose -</option>
<option value="">Single Family</option>
<option value="">Two Family</option>
<option value="">Multi-Family</option>
<option value="vacant.php">Vacant Land</option>
<option value="">Condominium</option>
<option value="commercial.php">Commercial</option>
<option value="">Investment</option>
</form>

bradyj
06-25-2004, 09:09 PM
You omitted the values of the other options, making this less obvious...I'm guessing they're the same as the text string, so:


<select onchange="v=options[selectedIndex].value;if(/\.php$/i.test(v))self.location=v">
<option value="">- choose -</option>
<option value="">Single Family</option>
<option value="">Two Family</option>
<option value="">Multi-Family</option>
<option value="vacant.php">Vacant Land</option>
<option value="">Condominium</option>
<option value="commercial.php">Commercial</option>
<option value="">Investment</option>
</form>


Cool, thank you -- I will test accordingly :D I adjusted my post, and added maybe you guys had some better ideas about how to do this?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum