Click to See Complete Forum and Search --> : Pop up windows


adamthenewbie
04-20-2005, 03:51 PM
I have been using this code to do pop up windows. I noticed that if you use a pop up blocker the window will not open. Is there a better way that will still open with a pop up blocker?

<script language="JavaScript">
<!--
function test() {
windowprops = "top=150,left=150,scrollbars=yes, resizable=yes" + ",width=325 ,height=300";
window.open("test.php", "_blank", windowprops);
}
//-->
</script>
<a href = "#" onClick = "JavaScript: test();">Open Window</a>

AdamGundry
04-20-2005, 04:10 PM
You shouldn't really use popups and you can't guarantee they will open, but use this code for the link if you absolutely must have them:

<script type="text/javascript">
function pop(url)
{
window.open(url, '_blank', 'top=150,left=150,scrollbars=yes,resizable=yes,width=325,height=300');
}
</script>

<a href="test.php" onclick="pop(this.href); return false;">Open Window</a>
Adam