The show()
method shows a non-modal dialog.
The show() method is currently only supported in Opera 24+, Chrome 37+ and Safari 6.
show |
Yes 37+ | No | No | Yes 6+ | Yes 24+ |
dialogObject.show()
The following code shows how to show and close a dialog 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>
<!--from w ww .j a v a 2 s . c o m-->
<script>
var x = document.getElementById("myDialog");
function showDialog() {
x.show();
}
function closeDialog() {
x.close();
}
</script>
</body>
</html>
The code above is rendered as follows: