Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

dialogHeight

Summary

Gets or sets the height of the content area of a dialog window.

Property of dom/WindowModaldom/WindowModal

Syntax

var height = window.dialogHeight;
window.dialogHeight = newHeight;

Return Value

Returns an object of type StringString

The height of the content area of the dialog window and a unit of measure.

Examples

This example creates a dialog window using the dialogHeight property to set the new window’s height.

<!doctype html>
<html>
 <head>
  <script>
function someMessage(e) {
    e.target.blur();
    window.showModalDialog("message.htm", "",
        "dialogWidth:5cm; dialogHeight:10cm")
}
  </script>
 </head>
 <body>
  <select onchange="someMessage(event)">
   <option>Item 1</option>
   <option>Item 2</option>
   <option>Item 3</option>
  </select>
 </body>
</html>

View live example

Notes

  • This property applies only to windows that are created by using the showModalDialog 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 dialogHeight 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.
  • Although a user can manually adjust the height of a dialog box to a smaller value—provided the dialog box is resizable—the minimum dialogHeight you can set using script is 100 pixels.
  • The default unit of measure is px.
  • 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 this property and dialogWidth in pixels when you design modal dialog boxes.

Attributions