...

View Full Version : Jump to url from dropdown list selection



david_uk
01-11-2007, 03:03 PM
Hi guys, I wonder can you help, I am creating a dropdown menu for my site because I have run out of space for a nav bar, what I would love to do is create a dropdown list that when an option is selected will jump to a specific URL.

Can you help please?

thanks,

Dave.

otaku149
01-11-2007, 03:25 PM
Try this:


<!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">
<head>
<title>Jump to url from dropdown list selection</title>
<script type="text/javascript">
function jump(obj){
if(obj.selectedIndex != 0){
window.location=obj.options[obj.selectedIndex].value;
}else{
alert('Please Select!!!');
}
}
</script>
</head>
<body>
<form name="form1">
<select name="jumpMenu" onchange="jump(this.form.jumpMenu)">
<option selected value=""> Please Select </option>
<option value="http://google.com/"> Google </option>
<option value="http://altavista.com/"> AltaVista </option>
<option value="http://yahoo.com/"> Yahoo </option>
</select>
</form>
</body>
</html>

david_uk
01-11-2007, 03:32 PM
Hey Thanks Martial, worked great....

Dave. :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum