Wrox Programmer Forums
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 26th, 2005, 12:35 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default onselect

<select name="book_date" id="book_date">
<option value="0">Today</option>
<option value="1">1 day ago</option>
<option value="2">2 days ago</option>
<option value="3">3 days ago</option>
<option value="4">4 days ago</option>
</select>

when a value from this drop-down box is selected, i want to go straight to the next page - display_bookings.asp.

what is the syntax for the onselect?

Thanks folks.

Picco

__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old January 26th, 2005, 12:39 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

When the selection changes, the onchange event is fired.

HTH,

Chris

 
Old January 26th, 2005, 12:42 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

<select name="book_date" id="book_date" onChange="display_bookings.asp">
<option value="0">Today</option>
<option value="1">1 day ago</option>
<option value="2">2 days ago</option>
<option value="3">3 days ago</option>
<option value="4">4 days ago</option>
</select>

is that right?


 
Old January 26th, 2005, 12:44 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

think that should be:

<select name="book_date" id="book_date" onChange="location.href='display_bookings.asp'">
<option value="0">Today</option>
<option value="1">1 day ago</option>
<option value="2">2 days ago</option>
<option value="3">3 days ago</option>
<option value="4">4 days ago</option>
</select>


 
Old January 26th, 2005, 12:47 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

That would change the location but it ignores the selected value, you might as well have a normal link.


--

Joe (Microsoft MVP - XML)
 
Old January 26th, 2005, 12:49 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

how do i pass the value as well?

 
Old January 26th, 2005, 12:54 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Place the urls in the values for the options & use something like...
Code:
onchange="location.href = this[this.selectedIndex].value;"
HTH,

Chris

 
Old January 26th, 2005, 12:57 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

i'm not too sure what you mean, urls in the values???

<select name="book_date" id="book_date" onChange="location.href='display_bookings.asp'">
<option value="0">Today</option>
<option value="1">1 day ago</option>
<option value="2">2 days ago</option>
<option value="3">3 days ago</option>
<option value="4">4 days ago</option>
</select>

thats my drop-down, how do i pass the option or value....

 
Old January 26th, 2005, 12:59 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

<select name="book_date" id="book_date" onChange="location.href='display_bookings.asp; this[this.selectedIndex].value'">

this doesnt work....

 
Old January 26th, 2005, 01:05 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

No kidding :)

What is the url you want to go to if "Today" is chosen (including any querystring values to tell it apart from the other options)?

Cheers,

Chris










Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.