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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<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[th is.selecte dIndex].va lue)">
<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>
<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.
<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>
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
nedwob
<script language="JavaScript" type="text/javascript">
function go1(winName,features){
if (document.selecter1.select
window.open(document.selec
}
}
</script>
<form name="selecter1"><select name="select1" size=1 onchange="go1('WindowName'
<option value=none>Select your destination
<option value=none>---------------
<option value="here.htm">here
<option value="there.htm">there
</select>
</form>
:)