Accessing Select Box's Items when go button is clicked.
<html>
<head>
<title>Select Box Navigation</title>
<script language="JavaScript">
function gothere(){
var box = document.navform.navbox;
var where_to = box.options[box.options.selectedIndex].value;
if (where_to == "") {return}
else {window.location = where_to;}
}
</script>
</head>
<body>
<div align="center">
<br><br>
<form name="navform">
<select name="navbox">
<option>-- Select A Search Engine --
<option>
<option value="http://www.google.com/">Google
<option value="http://www.yahoo.com/">Yahoo!
<option value="http://www.altavista.com/">Alta Vista
<option value="http://www.about.com/">About.com
</select>
<input type="button" value="Go!" onClick="gothere()">
</form>
</div>
</body>
</html>
No comments:
Post a Comment