Dialog show()Method

Dialog 对象参考手册Dialog Object

Example

Show or close the dialog window:

var x = document.getElementById("myDialog");

function showDialog()
  {
  x.show();
  }

function closeDialog()
  {
  x.close();
  }

Try it Yourself »

Definition and Usage

The show() method is used to display the dialog window.

When this method is used to display the dialog window, users can still interact with other elements on the page. If you don't want users to interact with the page while the dialog window is open, you can use the showModal() method.

Tip:This method is usually used together with theclose()method.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Note:Currently, only Chrome Canary and Safari 6 browsers support the show() method.

Note:Even though Chrome Canary supports the <dialog> element, you must open chrome://flags in the Chrome address bar and enable the "Enable experimental Web Platform features" flag. After enabling it, you need to restart the Chrome browser.


Syntax

dialogObject.show()


Dialog 对象参考手册Dialog Object

Other Extensions