|
Q1399 How can I open a popup window in the middle of the screen?
irt.org | Knowledge Base | JavaScript | Window | Q1399 [ previous next ]
Q1399 How can I open a popup window in the middle of the screen?
Try the following which works in JavaScript 1.2:
<script language="JavaScript"><!--
function openWindow(width,height) {
x = (640 - width)/2, y = (480 - height)/2;
if (screen) {
y = (screen.availHeight - height)/2;
x = (screen.availWidth - width)/2;
}
window.open('nextpage.htm','newWin','width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x);
}
//--></script>
<form>
<input type="button" onClick="openWindow(100,200)" value="Click Me">
</form>
|
Feedback on 'Q1399 How can I open a popup window in the middle of the screen?'
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.