Dialog show() Method - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Dialog

Description

The show() method shows the dialog.

Syntax

The following code shows how to Show and close a dialog window:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="showDialog()">Show dialog</button>
<button onclick="closeDialog()">Close dialog</button>

<dialog id="myDialog">This is a dialog window</dialog>

<script>
var x = document.getElementById("myDialog");

function showDialog() {/*from   w w  w .  j  a  v  a2s .  co m*/
    x.show();
}

function closeDialog() {
    x.close();
}
</script>

</body>
</html>

Related Tutorials