Her finder du den hjelp jeg tror du trenger
http://www.echoecho.com/jsdropdown.htmTHE SCRIPT:
To make this script work on your page you need to add it to the head-section of your document.
Next you need to add onChange="DropDownMenu(this)" to each drop-down-menu that should call the script.
The onChange is added to the <select>-tag of the desired drop-down-menu.
Finally you need to add the desired URL and the optional target to each of the options in the menus.
To do this use the following syntax:
<option value="
http://www.yahoo.com">Yahoo</option> If you want to add a target to the link use this syntax:
<option value="
http://www.yahoo.com&target">Yahoo</option> where target is replaced by the target you want to use.
If, say, you wanted the link to open in a frame called "main" you would add:
<option value="
http://www.yahoo.com&main">Yahoo</option> Note:
You can also use the reserved targets:
"_blank"
"_top"
"_parent"
"_self"
Click here to get an explanation of these targets.
Finally you can enter FALSE in the URL-field to let the script know that the option shouldn't load a page.
This is what you will do if you want one of the options to be a header for the drop-down-menu
- like for example "SEACH-ENGINES" and "THIS SITE" in the two examples shown at the top of this page.
The script looks like this:
<script>
function DropDownMenu(entered)
{
// ***************************************************************************
// DROP DOWN MENU (c) Henrik Petersen / NetKontoret 1998 - All rights reserved
// Explained along with other useful scripts at:
http://www.echoecho.com/javascript.htm// You may freely use this script as long as you do not remove this line and the 2 lines above.
// ***************************************************************************
with (entered)
{
// Store the selected option in a variable called ref
ref=options[selectedIndex].value;
// Count the position of the optional &
splitcharacter=ref.lastIndexOf("&");
// The three lines below checks if a target goes along with the URL
// That is: (if a "&" is in the option-value).
// If so, the URL is stored in a variable called loc and the target
// is stored in a variable called target.
// If not the URL is stored in a variable called loc and "_self" is
// stored in the variable called target.
if (splitcharacter!=-1) {loc=ref.substring(0,splitcharacter); target=ref.substring(splitcharacter+1,1000).toLowerCase();}
else {loc=ref; target="_self";};
// create a varible called lowloc to store loc in lowercase characters.
lowloc=loc.toLowerCase();
// Skip the rest of this function if the selected optionvalue is "false".
if (lowloc=="false") {return;}
// Open link in current document
if (target=="_self") {document.location=loc;}
// Cancel eventual framesets and open link in current window
else {if (target=="_top") {top.location=loc;}
// Open link in new window
else {if (target=="_blank") {window.open(loc);}
// Open link in parent frame
else{if (target=="_parent") {parent.location=loc;}
// Open link in the specified frame
else {parent.frames[target].location=loc;};
}}}}
}
</script>