{"id":14589,"date":"2015-05-02T05:01:18","date_gmt":"2015-05-01T19:01:18","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=14589"},"modified":"2015-05-02T09:45:48","modified_gmt":"2015-05-01T23:45:48","slug":"html5-dialog-element-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/html5-dialog-element-primer-tutorial\/","title":{"rendered":"HTML5 Dialog Element Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dialog.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"HTML5 Dialog Element Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dialog.jpg\" title=\"HTML5 Dialog Element Primer Tutorial\"   \/><\/a><p class=\"wp-caption-text\">HTML5 Dialog Element Primer Tutorial<\/p><\/div>\n<p>HTML5 brought with it many great features to front-end work on the internet in HTML, and today we talk about one of the newly introduced, and very useful, elements called <a target=_blank title='HTML5 meter tag information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_dialog.asp'><i>&#8220;&lt;dialog&gt;&#8221;<\/i><\/a>.<\/p>\n<p>At its core the <i>&#8220;&lt;dialog&gt;&#8221;<\/i> element represents a popup box without any of the buttons like with Javascript&#8217;s &#8220;alert&#8221; and &#8220;confirm&#8221; and &#8220;prompt&#8221; <a target=_blank href='http:\/\/www.w3schools.com\/js\/js_popup.asp' title='Javascript popup box information from w3schools'>windows<\/a>.<\/p>\n<p>So what is its use?  It has positioning improvements inherent in the way you can &#8220;embed&#8221; the &#8220;dialog&#8221; elements inside other HTML elements for context (though we don&#8217;t really do this with today&#8217;s example, which is a Numbers 0 to 100 Game where the &#8220;dialog&#8221; element offers an alternative answering method in the web application), and there are more home-grown chances to work the event logic &#8230; fun for the whole family!<\/p>\n<p>This element is useful to show a popup dialog box that responds to all the usual events and can be styled in the usual CSS ways.  At the time of writing not all web browsers support it, so we show one that does, with Google Chrome, and one that doesn&#8217;t, with Mozilla Firefox.   In Firefox, the way we have it the functionality is still existant via a click on some text, but the border of the dialog elements is missing &#8230; you are just seeing its <a target=_blank href='http:\/\/www.w3schools.com\/jsref\/prop_html_innerhtml.asp' title='Javascript DOM innerHTML information from w3schools'>&#8220;innerHTML&#8221;<\/a> &#8230; a method you can use to cover, or not, lots of cross-browser issues.  If your browser does not support <a target=_blank title='HTML iframe tag information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_iframe.asp'>&#8220;iframe&#8221;<\/a> it will still display what you have in the &#8220;innerHTML&#8221; (the bits between &gt; and &lt;) that you can define, as you choose.<\/p>\n<p>So take a look at the HTML code in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dialog.html_GETME\" title=\"dialog.html\">dialog.html<\/a> (supervising <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/nask.html_GETME\" title=\"nask.html\">nask.html<\/a> &#8230; our &#8220;iframe&#8221; supervised functionality as we talked about with <a target=_blank title='WordPress Text Widget Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-text-widget-tutorial\/'>WordPress Text Widget Primer Tutorial<\/a> previously), or a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dialog.html\" title=\"live run\">live run<\/a>, for your perusal.  Hope it helps with an HTML project you are on now.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#14589' onclick='var dv=document.getElementById(\"d14589\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/?tag=prompt-popup-box\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d14589' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>HTML5 brought with it many great features to front-end work on the internet in HTML, and today we talk about one of the newly introduced, and very useful, elements called &#8220;&lt;dialog&gt;&#8221;. At its core the &#8220;&lt;dialog&gt;&#8221; element represents a popup &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/html5-dialog-element-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,15,17,37],"tags":[1524,250,275,276,476,477,576,578,1525,652,752,1523,967,997,1000,1319],"class_list":["post-14589","post","type-post","status-publish","format-standard","hentry","category-elearning","category-games","category-gui","category-tutorials","tag-alert-popup-box","tag-confirm-popup-box","tag-cross-browser","tag-cross-browser-issues","tag-game","tag-games-2","tag-html","tag-html5","tag-innerhtml","tag-javascript","tag-mathematics","tag-numbers","tag-popup","tag-programming","tag-prompt-popup-box","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/14589"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=14589"}],"version-history":[{"count":7,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/14589\/revisions"}],"predecessor-version":[{"id":14597,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/14589\/revisions\/14597"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=14589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=14589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=14589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}