View Full Version : center pop-up problem on 800x600 monitor res

07-07-2003, 09:19 PM

New here and trying to get some quick help or maybe just a quick reason why my center script is doing what it's doing.

The problem is really that the script actually works but I need to know if I can fix what it does.

My window size is 700x700 pixels. The problem is that the script centers the window and 10 pixels at the top and 10 pixels at the bottom of my page are cut off when viewing in 800x600 monitor resolution. I have a scroolbar scripted in but still..the top of the page is cut off. Can I adjust the script to where it just centers the page vertically and just comes in at the top of the page horizontally, not centered? Would much rather do that than not use the center script and way before considering to adjust my page size (I'm lazy and don't want to re do it)

Any help would be greatly appreciated


the script as it appears:

function popUp(page,PWidth,PHeight,id) {

Mr J
07-07-2003, 09:34 PM
Do you want to give this script a try

<script language="JavaScript" type="text/javascript">
function popWin(url,Width,Height){
var posX = (screen.availWidth - Width) / 2
var posY = (screen.availHeight - Height) / 2

var popUp = window.open(url,'pop','width='+Width+',height='+Height+',left='+posX+',top='+posY+',scrollbars=yes,r esizable=yes') // all one line
// -->

<a href="#null" onClick="popWin('yourpage.htm',400,150)">Example 3</a>
<a href="#null" onClick="popWin('yourpage.htm',150,400)">Example 4</a>