Jump to content

Recommended Posts

Posted

I recommend you Google to understand this, as it's pretty easy. I've explained how it works, but I don't want to write your code for you.

Posted

I searched google, and tried it several different ways myself, and it all failed. Could someone please help me understand how to use the ID attribute to get the value from the drop-down box. (you don't have to write the code, just help me understand)

Posted

right after i made this post i figured out how to do it, i belive the code is still acting up, but i think its the line that makes the browser navigate, i can fix that though.

Posted

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>

 

 

Posted
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.

Posted

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>

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...