Below I posted the basic code I use on a lot of current pages.
It creates an ordinary old fashioned drop down menu using javascript.
It also is not valid XHTML because of the "name" attribute used, but the javascript does not work without it.
So I was trying to find a way to
1. Do away with the javascript, because of course it does not work if a visitor has javascript disabled
2. Make sure it is valid XHTML
3. But still uses <option value=""></option> because the code with all the options is delivered somehow from another file and I cannot change that (or at least would be too much work).
So I looked various places but cannot find anything that solves my problem. There are plenty of other menus that would do the trick if I would start from scratch, but I need to be able to use <option value=""></option> for the menu.
I hope I am clear enough. Thanks!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function leapto(pulldown)
{
var myindex=pulldown.selectedIndex;
if (myindex>=0)
{ top.location=pulldown.options[myindex].value; }
}
</script>
<title></title>
</head>
<body>
<form id="menu" name="menu" action="java script:leapto(document.menu.dest)">
<p>
<select name="dest">
<option value="http://google.com">One</option>
<option value="http://yahoo.com">Two</option>
<option value="http://msn.com">Three</option>
<option value="http://yahoo.com">Four</option>
</select>
</p>
<p>
<input type="submit" name="button" id="button" value="Submit" />
</p>
</form>
</body>
</html>

New Topic/Question
Reply



MultiQuote





|