Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Immediate redirect from pulldown selection 1

Status
Not open for further replies.

Lochness30

Programmer
Jun 9, 2004
23
CA
Maybe this is easy and I'm retarded :) But I have a web site that has a pull down and then the user clicks the "Show Index" button underneith.

Is it possible to just immediately do the "Show Index" statement without them having to press the button. Ie Not have the button and just run the command when they select an item from the pulldown.

Thanks for any help.
 
yes. depending on your code...

Code:
<select onchange="window.location  = this.options[this.selectedIndex].value;">
  <option value="[URL unfurl="true"]http://www.google.com/">Google</option>[/URL]
  <option value="[URL unfurl="true"]http://www.yahoo.com/">Yahoo!</option>[/URL]
  <option value="[URL unfurl="true"]http://www.msnbc.com/">Msnbc</option>[/URL]
</select>

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
beware of active imagination: [URL unfurl="true"]http://www.coryarthus.com/[/url]

[banghead]
 
That onchange looks promising. My list is created by php code and then it calls itself with a submit command. Not sure if your familiar with php, but it's like this...

<select name="cCategory" id="cCategory">
<?php do { ?>
<option value="<?php echo $row_rsCategory['NAME']?>"><?php echo $row_rsCategory['NAME']?></option>
<?php} while ($row_rsCategory = mysql_fetch_assoc($rsCategory));
</select>

<input type="submit" name="Submit" value="Show Index">

So is it possible for javascript to issue a SUBMIT?

Thanks for your reply!
 
OMG It worked!! After all that playing around with Javascripts and finding out it wasn't needed. Thanks so much.
 
hehe...

that IS javascript. Users with javascript disabled will still have to manually submit the form by clicking the submit button.

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
beware of active imagination: [URL unfurl="true"]http://www.coryarthus.com/[/url]

[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top