Browser popup window by JavaScript

Use this script to open browser pop-up windows when you click a link or an image

The script can position the new window at a given x and y position on the screen, you can specify window width, height and you can specify what other items to apear or to hide on the window (buttons, status bar, etc)

Sample popup

Click this link to open a sample popup: Open a pop-up

Add this code in the <head>...</head> area of your code:

<script language="JavaScript" type="text/javascript"><!--
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
if(popUpWin)
{
if(!popUpWin.closed) popUpWin.close();
}
popUpWin = open(URLStr, 'popUpWin', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width='+width+', height='+height+', left='+left+', top='+top+', screenX='+left+', screenY='+top+'');
}//-->
</script>

Then add this code in <body>...</body>:

<a href="#" onclick="javascript:popUpWindow('http://www.thewebhelp.com', '200', '200', '320', '240')">Open a pop-up</a>

Share with Google Plus