//p1.php
<html>
<head>This is head <title> this is title</title> </head>
<body>
<form>
<center> this is my page </center>
<a href=”javascript:openPopupWindow(‘p2.php’,'TestPopup’);” >Click</a>
</form>
</body>
</html>
<script language=”javascript”>
function openPopupWindow(url,popupName) {
if (popupName && popupName != ‘undefined’) {
}
else {
popupName = ‘PopupName’;
}
//popupName
window.open(url,’TestPopup’,”width=400,height=300,top=75,left=75,scrollbars=yes”);
} // END function – openPopupWindow
</script>
//p2.php
<html>
<head>This is head <title> this is title</title> </head>
<body>
<form>
<center> this is my page </center>
<?
echo ‘nilesh page2′;
?>
<A href=”p3.php” target=”_blank”>Click</A>
</form>
</body>
</html>
Moving the window to a desired location
You can use the window.moveTo function to move the popup window to a desired location.
The code below shows positioning the popup at a desired location
function mypopup() {
mywindow = window.open ("http://www.javascript-coder.com",
"mywindow","location=1,status=1,scrollbars=1,
width=100,height=100");
mywindow.moveTo(0,0);
}
Popup On Exit
The following code pops up a window when the user exits a page. <html>
<head>
<title>JavaScript Popup Example 3</title>
</head>
<SCRIPT language="JavaScript1.2">
function exitpop() {
my_window= window.open ("",
"mywindow1","status=1,width=350,height=150");
my_window.document.write('<H1>Popup Test!</H1>');
}
</SCRIPT>
<body onunload="javascript: exitpop()" >
<H1>JavaScript Popup Example 4</H1>
</body>
</html>
reference site name:
http://www.javascript-coder.com/window-popup/javascript-window-open.phtml


