The showModal()
method shows the dialog.
showModal |
Yes 37+ | No | No | Yes 6+ | Yes 24+ |
dialogObject.showModal()
The following code shows how to show a dialog window.
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Show dialog</button>
<dialog id="myDialog">This is a dialog window</dialog>
<!-- w ww . j a v a2s . co m-->
<script>
function myFunction() {
document.getElementById("myDialog").showModal();
}
</script>
</body>
</html>
The code above is rendered as follows: