{"id":13295,"date":"2015-12-26T02:01:59","date_gmt":"2015-12-25T16:01:59","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=13295"},"modified":"2016-09-22T13:05:48","modified_gmt":"2016-09-22T03:05:48","slug":"html-button-ideas-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-button-ideas-primer-tutorial\/","title":{"rendered":"HTML Button Ideas Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/button_ideas.htm\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"HTML Button Ideas Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/button_ideas.jpg\" title=\"HTML Button Ideas Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">HTML Button Ideas Primer Tutorial<\/p><\/div>\n<p>HTML is full of possibilities to simulate the pressing or touching action of a button.<\/p>\n<p>Some HTML element types we show in a button pressing style today with our HTML programming source code <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/button_ideas.html-GETME\" title='button_ideas.htm'>button_ideas.htm<\/a> are &#8230;<\/p>\n<ul>\n<li><a target=_blank href='http:\/\/www.w3schools.com\/tags\/tag_button.asp' title='Button information from w3schools'><i>button<\/i><\/a> tag<\/li>\n<li><a target=_blank href='http:\/\/www.w3schools.com\/tags\/tag_input.asp' title='Input button information from w3schools'><i>input type=&#8221;button&#8221;<\/i><\/a> tag<\/li>\n<li><i><a target=_blank href='http:\/\/www.w3schools.com\/tags\/tag_a.asp' title='A link information from w3schools'>a<\/i><\/a> tag<\/li>\n<li><a target=_blank href='http:\/\/www.w3schools.com\/tags\/tag_input.asp' title='Input file information from w3schools'><i>input type=&#8221;file&#8221;<\/i><\/a> tag<\/li>\n<li><a target=_blank href='http:\/\/www.w3schools.com\/tags\/tag_div.asp' title='Div information from w3schools'><i>div<\/i><\/a> tag<\/li>\n<\/ul>\n<p>&#8230; for each of these we can, when pressing them, converge on a common <a target=_blank title='Onclick event information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/event_onclick.asp'><i>onclick<\/i><\/a> event piece of Javascript code.<\/p>\n<p><code><br \/>\n&lt;script type='text\/javascript'&gt;<br \/>\nfunction doalert(ib) {<br \/>\n  alert(\"Clicking \" + ib.id.replace('_', ' ').replace('_', ' '));<br \/>\n}<br \/>\n&lt;\/script&gt;<br \/>\n<\/code><\/p>\n<p>With the <i>input type=&#8221;file&#8221;<\/i> it goes on with extra native functionality to browse for a file that may later be uploaded somewhere.<\/p>\n<p>Please know there would be many other types of HTML elements you could use in this way as well.<\/p>\n<p>Being different HTML elements they are capable of other functionalities, but the most common event we program for, the click, is very useful in lots of places.<\/p>\n<p>In Javascript this <i>onclick<\/i> event can be automated on many HTML elements via the Javascript DOM idea to &#8230;<\/p>\n<p><code><br \/>\ndocument.getElementById([theElementID]).click();<br \/>\n<\/code><\/p>\n<p>So the next time you want to &#8220;act&#8221; spare some thought for the ways you can (CSS) style that HTML element where you want to &#8220;act&#8221;.<\/p>\n<p>Try a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/button_ideas.htm\" title='live run'>live run<\/a> if you like, and see you soon.<\/p>\n<p><b><i>Stop Press<\/i><\/b><\/p>\n<p>When we originally wrote this blog posting we&#8217;d forgotten that for the non-button like HTML elements (like for <i>div<\/i> and <i>a<\/i> element types above) there would be a default CSS <a target=_blank title='CSS cursor property information from w3schools' href='http:\/\/www.w3schools.com\/cssref\/pr_class_cursor.asp'>cursor<\/a> that is not quite so user experience (<a target=_blank title='UX information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/User_experience'>UX<\/a>) &#8220;good&#8221; for &#8220;button&#8221; thinking as it would be for a &#8230; &#8220;button&#8221; type of element &#8230; doh!  But it makes for a better user experience, if you really want the user to feel they are pressing a button, to use a CSS &#8220;cursor:pointer&#8221; style property setting for a more conventional user &#8220;button&#8221; experience (on those <i>div<\/i> and <i>a<\/i> element types above).  The HTML software <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/button_ideas.html-GETME\" title='button_ideas.htm'>button_ideas.htm<\/a> link and <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/button_ideas.htm\" title='Click picture'>live run<\/a> links above now reflect this change, and you may, for comparison&#8217;s sake, now, be interested in the details of <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/button_ideas.html-GETME\" title='button_ideas.htm'>this change<\/a> and how it <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/button_ideas.html\" title='Old button_ideas.html has no cursor:pointer bits'>used to run<\/a>.<\/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='#d13295' onclick='var dv=document.getElementById(\"d13295\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=html\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d13295' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>HTML is full of possibilities to simulate the pressing or touching action of a button. Some HTML element types we show in a button pressing style today with our HTML programming source code button_ideas.htm are &#8230; button tag input type=&#8221;button&#8221; &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-button-ideas-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":[174,211,281,354,400,576,652,861,981,997,1200,1294,1319],"class_list":["post-13295","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-button","tag-click","tag-css","tag-dom","tag-event","tag-html","tag-javascript","tag-onclick","tag-press","tag-programming","tag-stop-press","tag-touch","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/13295"}],"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=13295"}],"version-history":[{"count":5,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/13295\/revisions"}],"predecessor-version":[{"id":25171,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/13295\/revisions\/25171"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=13295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=13295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=13295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}