Click to See Complete Forum and Search --> : autoload pop-up menu


geuis
02-05-2003, 01:01 PM
Real simple one but I forgot how to do this.

I have a pop-up menu w/ a list of selections. When one is chose from the list, I want it to auto-load another website. I know it has something to do w/ the selectedindex property for the <option value=""> but I've forgotten how to write it.

Thanks.

Charles
02-05-2003, 01:08 PM
It's very bad to rely upon JavaScript for navigation. (One in ten users do not use it.) The form should look like:

<form onsubmit="self.location.href = this.url.value; return false" action="menu.pl">
<div>
<select size="1" name="url">
<option value="http://www.w3.org/TR/REC-html32">HTML 3.2</option>
<option value="http://www.w3.org/TR/html4/">HTML 4.01</option>
<option value="http://www.w3.org/TR/xhtml1/">XHTML&trade; 1.0</option>
</select>
<input type="submit">
</div>
</form>

And then get up and running on the server something like the following and named menu.pl:

#!usr/local/bin/perl
use CGI qw(redirect param);
print redirect param ('url');