Popup window from form drop down

A simple script that allows you to launch popup windows from a dropdown menu. Any number of links can be added to the options list. The popup window features can be set within the script. Great for saving space on the page when long lists are required, for image popups, and for offsite referrals while still keeping people on your page.

Put the following script in the body of your page where you wish the dropdown menu to appear. Just follow the pattern in the options to set up the pages you wish to open in the popup window.

You can set the popup window features in the function call within the windowDoPop=(...) by changing no to yes for toolbar, location, menu, status, scrollbars, etc., as well as the window height= and window= therein.

Take care to have the entire windowDoPop=(...); on a single line without intervening spaces or linefeeds.

<script>
var windowDoPop
function go(whichURL) {
	windowDoPop=window.open(whichURL[whichURL.selectedIndex].value,'doPop','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=200,height=200');
	windowDoPop.focus();
}
//-->
</script>
<form>
<select name="selecturl" size="1">
<option value="http://www.example.com/1.html">Picture One</option>
<option value="http://www.example.com/2.html">Picture Two</option>
<option value="http://www.example.com/3.html">Picture Three</option>
<option value="http://www.example.com/4.html">Picture Four</option>
<option value="http://www.example.com/5.html">Picture Five</option>
</SELECT>
<input type="button" value="go" onclick="go(this.form.selecturl.options)">
</form>

Additional Tips

Positioning the Popup Window

If you want the popup window to locate itself at a certain position, put the following short script in the of the page that is opened. The numbers are the x and y positions on the screen, respectively.

<script>
self.moveTo(100,100)
</script>

Focusing the Popup Window

To ensure that the popup window comes into focus (that is, to the front), you may wish to add self.focus() to the body tag of the page, like this:

<body onload="self.focus()">

Although IE4-6 and NS3-4 do not require this, NS6 does.