Log in

View Full Version : Links an Chained Selects.



penguins87
07-21-2009, 02:08 AM
Hello, I was wondering how to do this: I have my chained selects script I downloaded all set up but I wan the end links to link to certain webpages. What would the code be to click submit and have it go to a certain page based on the end selection?

Thanks

vwphillips
07-21-2009, 11:01 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script type="text/javascript">
/*<![CDATA[*/
function Link(sel){
var url=sel.value
if (url) sel.form.action=url;//window.top.location=url;
}
/*]]>*/
</script></head>

<body>
<form >
<select onchange="Link(this);">
<option value="" >Select</option>
<option value="http://www.vicsjavascripts.org.uk/" >Vics Javascripts</option>
<option value="http://www.dynamicdrive.com/" >Dynamic Drive</option>
</select>
<input type="submit" name="" value="Submit" />
</form>
</body>

</html>