<select>

It doesn't matter if you do all the error checking in the world, or if you have the most beautiful graphics, if your site or application design isn't usable, it's not going to do well. Get input and advice on usability and user interface issues here.

Moderator: General Moderators

Post Reply
User avatar
sutejok
Forum Commoner
Posts: 37
Joined: Wed Mar 24, 2004 4:08 pm

<select>

Post by sutejok »

can someone give me the syntax for <select> which automaticly go to some page when it is selected?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Well, just put an "onChange" handler on the select box. In that handler, put a javascript function that gets the value of that select box, then forwards the user on to a particular page dependant on that value.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
sutejok
Forum Commoner
Posts: 37
Joined: Wed Mar 24, 2004 4:08 pm

Post by sutejok »

hmm. may i know the syntax for the javascript?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

People always learn best by doing :). Essentially, you want to pass to that function "this", which is a reference to the select box that calls it. Then, you want to get the value selected ([whatever you call the variable in the function].value), and check it - a bunch of if/else statements should work. Then, change the location of the page. I think document.location = newpage.html should work for that.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

there are loads of scripts/tutorials out there on the net, search for javascript jump box in google.
Post Reply