Controlling pop-up windows through JavaScript

Controlling pop-up windows through JavaScript

Have you been wondering how to pop-up a new window in the center of the browser screen the way you desire. To actually center the pop up window, you need the use of the window objects outer width, and outer height property and screen object width and height property. Use the following code.

Function centerWindow() { if (document.all) { var xMax = screen.width, yMax = screen.height } else if (document.layers) { var xMax = window.outerWidth, yMax = window.outerHeight } else { var xMax = 640, yMax=480 } var xOffset = (xMax - 200)/2, yOffset = (yMax - 200)/2;'testpage.htm','Example','width=200,height=200,screenX='+x Offset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'') }
This was first published in June 2001

Dig deeper on Domino Resources - Part 3



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...