Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Aligning pop up windows

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have this script here that does a pop up, but I don't know where to align the pop. I want my pop up in the middle of the screen.

<script>
function soap() {
NewWin=window.open('Afirst.htm','soap','toolbar=no,status=no,scrollbars=yes,width=790,height=500');}
</script>
 
try this
<script language=&quot;JavaScript&quot;><!--
function soap(width,height) {
x = (640 - width)/2, y = (480 - height)/2;

if (screen) {
y = (screen.availHeight - height)/2;
x = (screen.availWidth - width)/2;
}

window.open('Afirst.htm','soap','width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x,'toolbar=no,status=no,scrollbars=yes');
}
//--></script>
</script>

<body>
<form>
<input type=&quot;button&quot; onClick=&quot;soap(790,500)&quot; value=&quot;Click Me&quot;>
</form> I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top