spacer
Yehuda Shiran August 18, 2001
The Dialog Box's Position
Tips: August 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

By default, a dialog box is centered within the desktop. This is the default of the center property. Notice where the window opens when center is set to no. The possible values of the center property are: yes, no, 1, 0, on, and off. Their semantics are intuitive. This is how we turned off centering of the above window:

window.showModalDialog('010818.html','',
  'dialogHeight:200px;dialogWidth:800px;center:no');
The window opens close to the upper-left corner of the desktop. You can control the specific location of the window with the dialogLeft and dialogTop parameters. Let's position our window 300 pixels and 500 pixels to left and top, respectively, of the upper-left corner of the desktop:

window.showModalDialog('010818.html','',
  'dialogHeight:200px;dialogWidth:800px;dialogLeft:300;
   dialogTop:500');
Even if you do center the window, its position specifications (dialogLeft and dialogTop) override the centering request. Try it:

window.showModalDialog('010818.html','',
  'dialogHeight:200px;dialogWidth:800px;dialogLeft:300;
  dialogTop:500';center:yes);
For more on modal and modeless dialog boxes, go to Column 90, Modal and Modeless Dialog Boxes.


People who read this tip also read these tips:

Look for similar tips by subject:


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
IBM DB2 10 for z/OS: Justifying the Upgrade · Living La Vida Colo: Choosing the Right Colocation Facility · FTC Concerns over Social Media Privacy Linger