{"id":49761,"date":"2020-07-28T03:01:57","date_gmt":"2020-07-27T17:01:57","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=49761"},"modified":"2020-08-01T09:39:14","modified_gmt":"2020-07-31T23:39:14","slug":"button-versus-input-type-equals-button-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/button-versus-input-type-equals-button-primer-tutorial\/","title":{"rendered":"Button Versus Input Type Equals Button Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/button_vs_input_type_button.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Button Versus Input Type Equals Button Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/path_to_improvement.jpg\" title=\"Button Versus Input Type Equals Button Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Button Versus Input Type Equals Button Primer Tutorial<\/p><\/div>\n<p>It&#8217;s an &#8230;<\/p>\n<blockquote><p>\noh, by the way\n<\/p><\/blockquote>\n<p> &#8230; day for us today!  We&#8217;re poets <font size=3>and for the life of me <font size=2>we don&#8217;t know it<\/font> <font size=1>(well, you had to be there, &#8216;ay!)<\/font><\/p>\n<p>Are you here as an early days programming learner?  We recently came by an excellent website for learning programming for young people.  Here is a link for <a target=_blank title='Coding For Kids: Getting Started Learning Programming' href='https:\/\/docs.google.com\/document\/d\/1cETgPP6Z78NeBgORkmRq-DPo1uCln-ljQT2McwzKFPU\/edit?usp=sharing'>Coding For Kids: Getting Started Learning Programming<\/a> that we recommend you visit.<\/p>\n<p>We have a &#8220;proof of concept&#8221; idea we wanted to prove.   We don&#8217;t, around here, often use the HTML button element, and perhaps you are not the same, and do not need to read on.  In the back of my mind I knew the difference between the &#8230;<\/p>\n<ul>\n<li>input type=button element uses the <i>value<\/i> attribute as the one to one with how it displays &#8230; but <font size=2>tee, hee<\/font> <font size=1>(well, you had to be there)<\/font> &#8230;<\/li>\n<li>button element uses an <i>innerHTML<\/i> property (a bit like <i>textarea<\/i> and less like <i>div<\/i>) as the one to one with how it displays<\/li>\n<\/ul>\n<p> &#8230; and of course up to now we got by <font size=2>(perhaps stupidly <\/font><font size=1>(well, you had to be there)<\/font><font size=2>)<\/font> not making use of the &#8220;verticality&#8221; (as we find so pleasing with <i>textarea<\/i> quite often) talents of using the <i>innerHTML<\/i> property of an element.<\/p>\n<p>Our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/button_vs_input_type_button.html\" title=\"Click picture\">&#8220;proof of concept&#8221; web application<\/a> &#8220;email address&#8221; usage &#8230;<\/p>\n<ul>\n<li>defaults an &#8220;email address&#8221; via window.<a target=_blank title='Window object sessionStorage property' href='https:\/\/www.w3schools.com\/jsref\/prop_win_localstorage.asp'>localStorage<\/a> &#8230; ahead of &#8230;<\/li>\n<li> displaying within an HTML form whose purpose it is to open the email client via the clicking of an &#8220;a&#8221; &#8220;mailto:&#8221; link <i>href<\/i> attribute filled in appropriately &#8230;\n<ol>\n<li>button + <i>a<\/i> element &#8220;button&#8221;<\/li>\n<li>button + <i>div contenteditable=true<\/i> element &#8220;button&#8221;<\/li>\n<li>input type=submit (but you can think type=button for most intents and purposes)<\/li>\n<\/ol>\n<\/li>\n<li>the last of which can be programmatically clicked by the others (and we actually might hide that <i>input type=submit<\/i> along the way) &#8230; the interest being that &#8230;<\/li>\n<li>either button scenario above is capable of gleaning the email address (with the div embedding avoiding any Javascript prompt popups) &#8230; and &#8230;<\/li>\n<li>if valid email address store back into window.<a target=_blank title='Window object sessionStorage property' href='https:\/\/www.w3schools.com\/jsref\/prop_win_localstorage.asp'>localStorage<\/a> (ready for another re-entry into the web application and saving time, perhaps)<\/li>\n<\/ul>\n<p> &#8230; and you can try out the workings of the HTML\/Javascript <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/button_vs_input_type_button.html_GETME\" title=\"button_vs_input_type_button.html\">button_vs_input_type_button.html<\/a> below &#8230;<\/p>\n<p><iframe style=\"width:100%;height:400px;\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/button_vs_input_type_button.html\"><\/iframe><\/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='#d49761' onclick='var dv=document.getElementById(\"d49761\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/button\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d49761' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s an &#8230; oh, by the way &#8230; day for us today! We&#8217;re poets and for the life of me we don&#8217;t know it (well, you had to be there, &#8216;ay!) Are you here as an early days programming learner? &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/button-versus-input-type-equals-button-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,14,37],"tags":[112,174,2442,2463,342,380,400,452,576,1525,609,2533,2415,860,861,997,1986,2232,2024,2940,1319,3035],"class_list":["post-49761","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-attribute","tag-button","tag-contenteditable","tag-default","tag-div","tag-email","tag-event","tag-form","tag-html","tag-innerhtml","tag-input","tag-line-feed","tag-localstorage","tag-onblur","tag-onclick","tag-programming","tag-proof-of-concept","tag-property","tag-session","tag-stoppropagation","tag-tutorial","tag-vertical"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/49761"}],"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=49761"}],"version-history":[{"count":16,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/49761\/revisions"}],"predecessor-version":[{"id":49806,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/49761\/revisions\/49806"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=49761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=49761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=49761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}