Subscribe to Tutorial Feed

Flash and PHP Bible

The Flash and PHP Bible has been released! The book can be found on Amazon or wherever fine books are sold in your area.

The Flash and PHP Bible has a forum for quick support.

Scriptplayground » tutorials » js » Javascript Popup

Javascript Popup

A javascript popup that reuses the popup window once it is opened.

<script type="text/javascript">
<!--

function myOpenWindow(winURL, winName, winFeatures, winObj)
	{
	var theWin;
	if (winObj != null)
		{
		if (!winObj.closed) 
			{
			winObj.focus();
			return winObj;
			}
		}
	theWin = window.open(winURL, winName, winFeatures);
	return theWin;
	}

var myWin = null;

//-->
</script>

This is a code snippet that creates a popup and reuses the window once it is opened

<a href="http://www.google.com" onclick="myWin=myOpenWindow(this,
'Window Name','height=400,width=300,scrollbars=no',myWin); return false">Example Link</a>

Here is an example use of the code

Follow Scriptplayground on Twitter (@scriptplay)

Comments: Javascript Popup

 nababan  Sun Jun 20, 2010 10:33 am  
How to make an auto popup link redirect?
imagine i have a link to a new site, but when clicked it make open two link address with one as redirect and one as pop-up windows. thankyou
Add a comment
The ability to add new comments has been disabled in this archived version.

Loading
Main | Tutorials | Articles