EZE Posted January 19, 2007 Share Posted January 19, 2007 Okay, I have been trying to write a pop-up function for javascript that is centered, and specifies the width, height, and url in the function. Everything in the script i made is correct and working, except the yPosition variable. The xPosition variable is outputting correctly though. Here is my script:[code]<script type="text/javascript">function OpenWindow(url, w, h){ var xPosition = ((document.width-w)/2); var yPosition = ((document.height-h)/2); window.open("" + url + "", "contentwin","width=" + w + ",height=" + h + ",scrollbars=no,status=no,resizable=no,screenX=" + xPosition + ",screenY=" + yPosition + "");}</script><a href="#" onclick="OpenWindow('http://phpfreaks.com/',450,500);">Click</a>[/code]What can i do to fix this? I am trying to use this type of pop up function, not a pre-written one, so if anybody could help me debug this script, it would be awesome. Quote Link to comment Share on other sites More sharing options...
EZE Posted January 20, 2007 Author Share Posted January 20, 2007 *bump* Quote Link to comment Share on other sites More sharing options...
Jtech Posted January 21, 2007 Share Posted January 21, 2007 Rather specifie the width and height in the anchor ... specifie it in the script. Quote Link to comment Share on other sites More sharing options...
Jtech Posted January 21, 2007 Share Posted January 21, 2007 Nope .. dont do what i said .. i tryed your script out and it work just fine so ...so ;) Quote Link to comment Share on other sites More sharing options...
EZE Posted January 22, 2007 Author Share Posted January 22, 2007 Okay, I changed document to screen, so it works now. Problem Solved. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.