snippet library logo
in category
Javascript / Popups / Centered Popup
Snippet details
ID: 36
Viewed: 1453
Added: 2001-11-23
Version:
View Demo

User Rated at:
Rate This:
Snippets in this catagory         
Show Printable Version
open a popup in the center of the screen

General Details
Snippet uploaded by: snippet
Email : webmaster@snippetlibrary.com
Snippet By: Unknown

<!---Head--->
<script>
// open a popup centered on the screen 
Function centerWindow(popupUrl, popupWidth, popupHeight){ 
If(window.screen){ 
        var ah=screen.availHeight-30; 
        var aw=screen.availWidth-10; 
        var xc=(aw-popupWidth)/2; 
        var yc=(ah-popupHeight)/2; 
        Str =",left="+xc+",screenX="+xc; 
        Str +=",top="+yc+",screenY="+yc; 
        Str += ",width="+popupWidth+",height="+popupHeight; 
        } 
previewWindow = window.Open(popupUrl,"","toolbar=0,location=0,menubar=0,scrollbars=1,status=0,resizable=1,width="+popupWidth+",height="+popupHeight+""+Str); 
previewWindow.focus(); 

</script>

<!---Body--->


'Call it Like this
<a href="javascript:centerWindow('yourpage.html', 300, 200)">Open It</a> 




No Reviews to show


Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Subject:

Reviewed By:

Write a review:





Terms of Conditions
Powered By
Avian Hosting
© 2005 snippetlibrary.com All Rights Reserved.