Javatpoint Logo

Dialog tag in html5

By: janki6*** On: Tue Mar 21 11:40:47 IST 2017     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
Its not showing the dialog box when i am using dialog tag with javascript using same example given in your tutorial. I have also tried with separating the javascript file with html but there is no difference.I also selected the html5 version. I am using eclipse mars version for this.please help me how to do it in detail. Quick response will be appreciated.Thank you.

Here is code:
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<div>
<dialog id="myFirstDialog" style="width:50%;background-color:#F4FFEF;border:1px dotted black;">
<p><q>I am so clever that sometimes I don't understand a single word of what I am saying.
</q> - <cite>Oscar Wilde</cite></p>
<button id="hide">Close</button>
</dialog>
<button id="show">Show Dialog</button>
</div>

<!-- JavaScript to provide the "Show/Close" functionality -->
<script type="text/JavaScript">
(function() {
var dialog = document.getElementById('myFirstDialog');
document.getElementById('show').Onclick = function() {
dialog.show();
};
document.getElementById('hide').Onclick = function() {
dialog.close();
};
})();

</script>
</body>
</html>
Up0Down