Link to home
Start Free TrialLog in
Avatar of nedwob
nedwob

asked on

Opening item from Select List in new window

I want to have a 'select' tag on my HOME web page that provides a 'quick navigation' feature - when a visitor clicks a 'Topic' in the select list, I want the topic page to open in a NEW WINDOW.

I have tried a 'jump menu', but this defaults the target to 'parent'. Changing this item to '_blank' has no effect and the targetted page still opens in the original window.

All of my efforts with select tags and jump menus just result in the 'parent' window being used.

To prevent a proliferation of open windows, I would prefer the target to open in a 'Named' window, but other alternatives could be to open in '_blank' or in a window created by a javascript function.

Also, would it be necessary to use '<form>' and '</form>' tags to enclose the visible components?

thanks

nedwob
ASKER CERTIFIED SOLUTION
Avatar of dorward
dorward

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of abridge
abridge

This works for me - it also allows you to apply features to the new window

<script language="JavaScript" type="text/javascript">
function go1(winName,features){
if (document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value != "none") {
window.open(document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value,winName,features);
          }
     }
</script>
<form name="selecter1"><select name="select1" size=1 onchange="go1('WindowName','width=270,height=330')">
<option value=none>Select your destination
<option value=none>--------------------
<option value="here.htm">here
<option value="there.htm">there
</select>
</form>

:)
<html>
<head>
   <title>Open a new window with a dropdown using javascript!</title>
<script type="text/javascript">
<!--
function openWindow(val) {
   if(val) {
      myWin = window.open(val,"myWin");
      window.myWin.focus();
   }
}
// -->
</script>
</head>
<body>
   <form id="form1" action="javascript:void 0">
      <select name="myselect" onchange="openWindow(this.options[this.selectedIndex].value)">
         <option value="">Choose a website!</option>
         <option value="http://www.google.com">Google it!</option>
         <option value="http://www.yahoo.com">Yahoo!</option>
         <option value="http://www.download.com">Find a cool program!</option>
      </select>
   </form>
</body>
</html>
Avatar of nedwob

ASKER

Thanks to all who answered. I decided to accept the comment from 'dorward' because the link he provided has given me a lot of useful information.

nedwob