HTML DOM DialogObject
Dialog Object
The Dialog object is new in HTML5.
The Dialog object represents an HTML <dialog> element.
Note:Currently only Chrome Canary and Safari 6 browsers support the <dialog> element.
Accessing the Dialog Object
You can access a <dialog> element using getElementById():
var x = document.getElementById("myDialog");
Try it Yourself
Creating a Dialog Object
You can create a <dialog> element using the document.createElement() method:
var x = document.createElement("DIALOG");
Try it Yourself
Dialog Object Properties
| Property | Description |
|---|---|
| open | Sets or returns whether the dialog window is open |
| returnValue | Sets or returns the return value of the dialog |
Dialog Object Methods
| Method | Description |
|---|---|
| close() | Closes the dialog window |
| show() | Displays the dialog |
| showModal() | Displays the dialog and makes it the topmost dialog |
Standard Properties and Events
The Dialog object also supports standardPropertiesandEvents。
Related Articles
HTML Reference Manual:HTML <dialog> Tag
Other Extensions