 |
| 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
|
|
|
|

January 26th, 2005, 12:35 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 26th, 2005, 12:39 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
When the selection changes, the onchange event is fired.
HTH,
Chris
|
|

January 26th, 2005, 12:42 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
<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?
|
|

January 26th, 2005, 12:44 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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>
|
|

January 26th, 2005, 12:47 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
That would change the location but it ignores the selected value, you might as well have a normal link.
--
Joe ( Microsoft MVP - XML)
|
|

January 26th, 2005, 12:49 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
how do i pass the value as well?
|
|

January 26th, 2005, 12:54 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Place the urls in the values for the options & use something like...
Code:
onchange="location.href = this[this.selectedIndex].value;"
HTH,
Chris
|
|

January 26th, 2005, 12:57 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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....
|
|

January 26th, 2005, 12:59 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
<select name="book_date" id="book_date" onChange="location.href='display_bookings.asp; this[this.selectedIndex].value'">
this doesnt work....
|
|

January 26th, 2005, 01:05 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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
|
|
 |