holty
04-23-2004, 11:48 AM
Hi All :D
I want a dropdown box with links in, some links will open in the same window and others I want to open in a new window.
I have found some code to follow for opening in the same window, but as some of my links need to open in a new window I can't seem to get it to work...
Here is my code (well not mine really!)
<SCRIPT LANGUAGE="javascript">
<!--
function gotoLink() {
// Get the currently selected item from the menu
goingTo = document.quickMenu.link.options[document.quickMenu.link.selectedIndex].value;
// If the currently selected item is not valid, do nothing. Otherwise,
// redirect the browser to the newly selected page.
if (goingTo == "")
{ return; }
else
{ self.location = goingTo; }
}
// -->
</SCRIPT>
</head>
<body>
<FORM NAME="quickMenu">
<LABEL>Get information from <A HREF="http://www.yahoo.com">Yahoo</A> about one of the states:
</label>
<SELECT NAME="link" ONCHANGE="gotoLink()">
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Alabama/">Alabama</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Alaska/">Alaska</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Alabama/" target="_blank">Alabamatttt</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Alaska/">Alaska</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Alabama/">Alabama</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Alaska/">Alaska</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Arizona/">Arizona</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Arkansas/">Arkansas</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/California/">California</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Colorado/">Colorado</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Connecticut/">Connecticut</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Delaware/">Delaware</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Florida/">Florida</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Georgia/">Georgia</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Hawaii/">Hawaii</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Idaho/">Idaho</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Illinois/">Illinois</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Indiana/">Indiana</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Iowa/">Iowa</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Kansas/">Kansas</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Kentucky/">Kentucky</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Louisiana/">Louisiana</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Maine/">Maine</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Maryland/">Maryland</OPTION>
</SELECT>
</FORM>
</body>
Hope you can help - as you can see the target="_blank" doesn't work....
I want a dropdown box with links in, some links will open in the same window and others I want to open in a new window.
I have found some code to follow for opening in the same window, but as some of my links need to open in a new window I can't seem to get it to work...
Here is my code (well not mine really!)
<SCRIPT LANGUAGE="javascript">
<!--
function gotoLink() {
// Get the currently selected item from the menu
goingTo = document.quickMenu.link.options[document.quickMenu.link.selectedIndex].value;
// If the currently selected item is not valid, do nothing. Otherwise,
// redirect the browser to the newly selected page.
if (goingTo == "")
{ return; }
else
{ self.location = goingTo; }
}
// -->
</SCRIPT>
</head>
<body>
<FORM NAME="quickMenu">
<LABEL>Get information from <A HREF="http://www.yahoo.com">Yahoo</A> about one of the states:
</label>
<SELECT NAME="link" ONCHANGE="gotoLink()">
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Alabama/">Alabama</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Alaska/">Alaska</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Alabama/" target="_blank">Alabamatttt</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Alaska/">Alaska</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Alabama/">Alabama</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Alaska/">Alaska</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Arizona/">Arizona</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Arkansas/">Arkansas</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/California/">California</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Colorado/">Colorado</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Connecticut/">Connecticut</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Delaware/">Delaware</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Florida/">Florida</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Georgia/">Georgia</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Hawaii/">Hawaii</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Idaho/">Idaho</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Illinois/">Illinois</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Indiana/">Indiana</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Iowa/">Iowa</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Kansas/">Kansas</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Kentucky/">Kentucky</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Louisiana/">Louisiana</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Maine/">Maine</OPTION>
<OPTION VALUE="http://dir.yahoo.com/Regional/U_S__States/Maryland/">Maryland</OPTION>
</SELECT>
</FORM>
</body>
Hope you can help - as you can see the target="_blank" doesn't work....