Dialog close()Method

Dialog 对象参考手册Dialog Object

Example

Show and close the dialog window:

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

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

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

Try it »

Definition and Usage

The close() method is used to close the dialog window.

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Note:Currently only Chrome Canary and Safari 6 browsers support the close() 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.close()


Dialog 对象参考手册Dialog Object

Other Extensions