{"id":39635,"date":"2018-07-23T03:01:28","date_gmt":"2018-07-22T17:01:28","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=39635"},"modified":"2018-07-21T22:58:30","modified_gmt":"2018-07-21T12:58:30","slug":"html-a-link-innerhtml-extender-and-event-propogation-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-a-link-innerhtml-extender-and-event-propogation-primer-tutorial\/","title":{"rendered":"HTML a Link innerHTML Extender and Event Propogation Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/a_extender.html\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"HTML a Link innerHTML Extender and Event Propogation Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/a_extender.jpg\" title=\"HTML a Link innerHTML Extender and Event Propogation Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">HTML a Link innerHTML Extender and Event Propogation Primer Tutorial<\/p><\/div>\n<p>Guess the recent <a target=_blank title='PDF Attachments Canvas Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-attachments-add-page-tutorial\/'>PDF Attachments Add Page Tutorial<\/a> got me in the mood for &#8220;nesting&#8221;, and a curiosity I&#8217;ve always had, but never &#8220;implemented&#8221;, is to do a Javascript DOM thing that feels a lot like &#8220;linked list&#8221; work and involving an HTML &#8220;a&#8221; link&#8217;s <a target=_blank title='HTML innerHTML property information' href='http:\/\/www.w3schools.com\/jsref\/prop_html_innerhtml.asp'>innerHTML<\/a> property.<\/p>\n<p>Today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/a_extender.jpg\" title=\"Click picture\">tutorial picture<\/a>, we are hoping, is &#8220;worth a thousand words&#8221;, because this is a bit esoteric explaining purely in words, but will try as a &#8220;stepped set of instructions&#8221; below &#8230;<\/p>\n<ol>\n<li>start with a &#8220;a&#8221; link that looks as below &#8230;<br \/>\n<code><br \/>\n&lt;a title='Show me' style='text-decoration:underline;cursor:pointer;' id='origsnake1' onclick=\"show('tdsnake',this);\"&gt;Snakes ... &lt;\/a&gt;<br \/>\n<\/code>\n<\/li>\n<li>allow for user interaction that offers you to extend that &#8220;a&#8221; link&#8217;s wording as per the HTML &#8230;<br \/>\n<code><br \/>\n&lt;input type=text id='iadd' value=''&gt;&lt;\/input&gt;&nbsp;&lt;input style='background-color:yellow;' onclick=\"addthis(document.getElementById('iadd'));\" type='button' value='Add...'&gt;&lt;\/input&gt;<br \/>\n<\/code>\n<\/li>\n<li>clicking that button calls on <em>the salient<\/em> &#8220;linked list&#8221; feeling Javascript DOM code &#8230;<br \/>\n<code><br \/>\nvar addto='origsnake1';<br \/>\nfunction addthis(inputo) {<br \/>\n  var nextto=eval(1 + eval(addto.replace('origsnake','')));<br \/>\n  <em>document.getElementById(addto).innerHTML+=\"&lt;\/a&gt;&lt;a title='Show me' style='text-decoration:underline;cursor:pointer;' id='origsnake\" + nextto + \"' onclick=\\\"show('tdsnake',this);\\\"&gt;\" + inputo.value.replace(' ... ','').replace(' ...','').replace('...','') + \" ... \";<\/em><br \/>\n  addto='origsnake' + nextto;<br \/>\n}<br \/>\n<\/code>\n<\/li>\n<li>and the user clicking on one of those &#8220;a&#8221; links calls on Javascript code &#8230;<br \/>\n<code><br \/>\nfunction show(supervisor,curo) {<br \/>\n  alert(\"This innerHTML=\" + curo.innerHTML + \" and the overall table cell innerHTML=\" + document.getElementById(supervisor).innerHTML);<br \/>\n}<br \/>\n<\/code><br \/>\n &#8230; that propogates up through the hierarchy of &#8220;a&#8221; links created on the fly this way\n<\/li>\n<\/ol>\n<p>Perhaps you are in &#8220;nesting&#8221; form too, and find <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/a_extender.html_GETME\" title=\"a_extender.html\">a_extender.html<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/a_extender.html\" title=\"Click picture\">live run<\/a> interesting too?!<\/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='#d39635' onclick='var dv=document.getElementById(\"d39635\"); dv.innerHTML = \"<iframe width=670 height=600 src=\" + \"\/\/www.rjmprogramming.com.au\/ITblog\/tag\/event\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d39635' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Guess the recent PDF Attachments Add Page Tutorial got me in the mood for &#8220;nesting&#8221;, and a curiosity I&#8217;ve always had, but never &#8220;implemented&#8221;, is to do a Javascript DOM thing that feels a lot like &#8220;linked list&#8221; work and &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-a-link-innerhtml-extender-and-event-propogation-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":[400,564,576,1525,652,1807,703,997,2588,2617,1319],"class_list":["post-39635","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-event","tag-hierarchy","tag-html","tag-innerhtml","tag-javascript","tag-link","tag-linked-list","tag-programming","tag-propogate","tag-propogation","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/39635"}],"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=39635"}],"version-history":[{"count":5,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/39635\/revisions"}],"predecessor-version":[{"id":39649,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/39635\/revisions\/39649"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=39635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=39635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=39635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}