...

View Full Version : Open a Popup Window From A Dropdown Menu?



Shark Bite
08-10-2004, 08:01 PM
Hey all,

Can someone write me a script that opens a popup window, after you select an option from a dropdown menu and click a button? I'm a javascript n00b, so I have no idea how to write this one. I would truely appreciate it if you helped me out.

Thanks,
Shark Bite

Basscyst
08-10-2004, 08:07 PM
Here ya go.



<html>
<head>
<script type="text/javascript">

function winPop(url)
{
window.open(url,'newWin');
}
</script>
</head>
<body>
<form>
<select id="drop1">
<option selected>Select. . .</option>
<option value="http://www.codingforums.com">CF</option>
<option value="http://www.codingforums.com">CF</option>
<option value="http://www.codingforums.com">CF</option>
</select>
<input type="button" onclick="winPop(document.getElementById('drop1').options[document.getElementById('drop1').selectedIndex].value);" value="GO">

</body>
</html>


Basscyst

glenngv
08-11-2004, 03:46 AM
Modified it a bit.


function winPop(url)
{
if (url) {
var w=window.open(url,'newWin');
w.focus();
}
else alert("Please choose an item.");
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum