Forum Moderators: open

Message Too Old, No Replies

Pulldown where some open in same window, others in new

Has script to auto-go to url; need some to pop new win

         

timware

10:13 pm on Dec 5, 2003 (gmt 0)

10+ Year Member



I have a pulldown where, after selecting, the user is taken to the link without using a "go" button.

<select name="districts" onchange="window.location = this.options[this.selectedIndex].value" style="background-color: #F88C01; color: #FFFFFF; font-size: 9pt">

<option value="">Select a District
<option value="http://www.bham.wednet.edu">Bellingham, WA
<option value="name.html">Bellingham, WA
<option value="name.html">Bullingham, MS
</select>

If I just want to options that are off-site to pop a new window, how would I modify this script?

Thanks for any help!

Tim

DrDoc

11:07 pm on Dec 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just a small piece of advice (that should probably listen to): don't auto load the pages

timware

6:08 pm on Dec 8, 2003 (gmt 0)

10+ Year Member



Why shouldn't I auto-load the pages rather than making the user click a "go" button or whatever? Thanks.

DrDoc

6:25 pm on Dec 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What if the user tabbed to the dropdown, and the use the arrow keys to navigate through the dropdown? Or, what if they do use the mouse, but click on the wrong option?

Besides, a select element is not meant to trigger functionality. It is counterintuitive to use such elements (selects, radio buttons, and checkboxes) as a trigger to a function that navigates away from the page. If anything, use the select box to let the user select which page to go to, but let him/her make the final decision on whether to actually go there or not.

Finally, the last argument -- what if the user has turned off JavaScript to avoid annoying functionality to be forced upon him/her? Then your select box would do absolutely nothing!

As a rule of thumb, your page should be accessible and usable even if a person has JavaScript turned off, and no matter if they use the keyboard or mouse to navigate. In the end, this means that the "Go" button (or whatever you will end up calling it) should not point to a JavaScript function that redirects the user. Instead, the form should properly point to a script on the server side that can handle the user input, and on the server side redirect the user to the page he/she desired to visit.