Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

dialogWidth property

Sets or gets the width of the modal dialog window.



p = object.dialogWidth


Property values

Type: Variant

the width of the dialog window.


The dialogWidth property applies only to windows that are created by using the showModalDialog method and the showModelessDialog method.

When a script calls the showModalDialog method, it suspends execution until the modal dialog box is closed. As a result, the script cannot use the dialogWidth property to change the appearance of the modal dialog box. To control the appearance of the modal dialog box, use script in the file loaded by the sURL parameter or use the value of the sFeatures parameter to specify the desired settings.

In Windows Internet Explorer 7, the dialogWidth property returns the width of the content area and no longer includes the width of the frame.

The default unit of measure for dialogHeight and dialogWidth in Microsoft Internet Explorer 4.0 is the em; in Microsoft Internet Explorer 5 it is the pixel. The value can be an integer or floating-point number, followed by an absolute units designator (cm, mm, in, pt, or pc), or a relative units designator (em, ex, or px). For consistent results, specify the dialogHeight and dialogWidth in pixels when you design modal dialog boxes.


This example creates a dialog window using the dialogWidth property to set the new window's width.

Code example:

<!DOCTYPE html>

    The select box's <strong>onchange</strong> event will fire 
    off a script creating a modal dialog box, with a width of 5cm.
    <option>Item 1</option>
    <option>Item 2</option>
    <option>Item 3</option>
    document.getElementsByTagName('select')[0].addEventListener('change', someMessage, false);

    function someMessage(changeEvent) {
      window.showModalDialog("dialogWidth.htm", "", "dialogWidth:5cm; dialogHeight:10cm")

See also




© 2017 Microsoft