Jump to content

dropdown menu javascript


Recommended Posts

Does it just HAVE to be written that way? Will this not work for you?

 

<form name="" method="post" action="" enctype="application/x-www-form-urlencoded">
<select name="jump" size="1" onChange="location.href=(this.options[this.selectedIndex].value)">
<option> - Links - </option>
<option value="http://">Link</option>
<option value="http://">Link</option>
<option value="http://">Link</option>
<option value="http://">Link</option>
<option value="http://">Link</option>
</select>
</form>

 

 

Link to comment
Share on other sites

Does it just HAVE to be written that way? Will this not work for you?

 

<form name="" method="post" action="" enctype="application/x-www-form-urlencoded">
<select name="jump" size="1" onChange="location.href=(this.options[this.selectedIndex].value)">
<option> - Links - </option>
<option value="http://">Link</option>
<option value="http://">Link</option>
<option value="http://">Link</option>
<option value="http://">Link</option>
<option value="http://">Link</option>
</select>
</form>

Byron wins.

Link to comment
Share on other sites

well, i wanted to have the script in the header so i could easily impliment multiple boxes

 

ps: i have the working code written.

 

<html>
<head><script LANGUAGE="JavaScript">
function formHandler(x){
var y=document.getElementById(x);
var l=y.selectedIndex;
var m=y[l].value;
window.location= m;
}
/*instructions:
insert the code that is in the header in the header part of your page, and the body code into your page where you want the box to appear
you can add more options by adding more lines just like the existing ones.
in order to support multiple drop-down boxes on one page, you can copy the select object and rename the ID tag to something else ex:site2
made by: crazybmanp*/
</SCRIPT>
</head>
<body>
<select ID="site" size=1 onchange="formHandler(this.id)">
<option value="">Go to...
<option value="http://gamer-hotspot.heliohost.org/blog">Blog
<option value="http://gamer-hotspot.heliohost.org/forum/">Forum
</select>
</body>
</html>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...