{"id":58771,"date":"2023-03-26T03:01:30","date_gmt":"2023-03-25T17:01:30","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=58771"},"modified":"2023-03-25T18:47:09","modified_gmt":"2023-03-25T08:47:09","slug":"onclick-event-propagation-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/onclick-event-propagation-primer-tutorial\/","title":{"rendered":"Onclick Event Propagation Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/onclick_propagation.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Onclick Event Propagation Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/onclick_propagation.jpg\" title=\"Onclick Event Propagation Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Onclick Event Propagation Primer Tutorial<\/p><\/div>\n<p>A basis for web application event driven programming strategies references &#8230;<\/p>\n<ul>\n<li>element nesting and inheritance &#8230;<\/li>\n<li>the default event propagation up through the element hierarchy<\/li>\n<\/ul>\n<p>Of course you can ignore how this event &#8220;bubbling&#8221; can be harnessed, and indeed, we normally do not harness this event programming abilities in webpages, but not today!   Today, we want to harness, via &#8220;onclick&#8221; event (sharing a common &#8230;<\/p>\n<p><code><br \/>\n  function moi(othis) {<br \/>\n    var extras='';<br \/>\n    if (othis.outerHTML.substring(1).split(' ')[0].split('&gt;')[0] == 'details' || (othis.outerHTML.substring(1).split(' ')[0].split('&gt;')[0] == 'body' && blurbsuffix == '') || noway) {<br \/>\n    noway=true;<br \/>\n    if (othis.outerHTML.substring(1).split(' ')[0].split('&gt;')[0] == 'body') { noway=false; }<br \/>\n    } else {<br \/>\n    \/\/alert(blurbsuffix + ' ... ' + othis.outerHTML.substring(1).split(' ')[0].split('&gt;')[0]);<br \/>\n    if (('' + othis.id) != '') {  extras=' ID=' + othis.id; idfound=true; } else {<br \/>\n    if (eval('' + jdc) &gt;= eval('' + lotsofsix.length)) { jdc=0;  }<br \/>\n    if (eval('' + detnum) &gt; 0) {<br \/>\n    if (lotsofsix[jdc].split(';')[idc].indexOf('&lt;br&gt;') != -1) {<br \/>\n    if (document.getElementById('det' + eval(-1 + detnum))) {<br \/>\n    document.getElementById('det' + eval(-1 + detnum)).open=false;<br \/>\n    }<br \/>\n    }<br \/>\n    }<br \/>\n    blurb+='&lt;br&gt;' + lotsofsix[jdc].split(';')[idc].replace('&lt;br&gt;', '&lt;br&gt;&lt;details onclick=\"noway=false;\" id=det' + detnum + ' open&gt;&lt;summary&gt;') + detsuffix; detsuffix='';<br \/>\n    }<br \/>\n    detsuffix='';<br \/>\n    if (othis.outerHTML.substring(1).split(' ')[0].split('&gt;')[0] == 'body' && !idfound) {<br \/>\n    var suf=tableize(blurb.replace('&lt;\/summary&gt;&lt;br&gt;', '&lt;\/summary&gt;') + blurbsuffix);<br \/>\n    if (suf != '') { document.getElementById('results').innerHTML+=suf; }<br \/>\n    \/\/alert(document.getElementById('results').innerHTML);<br \/>\n    detsuffix='';<br \/>\n    blurbsuffix='';<br \/>\n    detnum++;<br \/>\n    } else if (idfound) {<br \/>\n    detsuffix='';<br \/>\n    blurbsuffix='';<br \/>\n    document.getElementById('results').innerHTML+=othis.outerHTML.substring(1).split(' ')[0].split('&gt;')[0] + extras + ' clicked.&lt;br&gt;';<br \/>\n    }<br \/>\n    jdc++;<br \/>\n    }<br \/>\n  }<br \/>\n<\/code><\/p>\n<p> &#8230; event &#8220;onclick&#8221; logic Javascript function, as above) propagation, the sharing of piecing together the content display of &#8230;<\/p>\n<p><code><br \/>\nSestet poems and rhymes<br \/>\n<\/code><\/p>\n<p> &#8230; where the six lines of poetry are written out by the &#8220;onclick&#8221; events of &#8230;<\/p>\n<ol>\n<li>button<\/li>\n<li>td<\/li>\n<li>tr<\/li>\n<li>tbody<\/li>\n<li>table<\/li>\n<li>body<\/li>\n<\/ol>\n<p> &#8230; in hierarchical order in the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/onclick_propagation.html_GETME\">&#8220;proof of concept&#8221; onclick_propagation.html<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/onclick_propagation.html\" title=\"Click picture\">Sestet web application<\/a> you can also try below &#8230;<\/p>\n<p><iframe style=\"width:100%;height:600px;\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/onclick_propagation.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='#d58771' onclick='var dv=document.getElementById(\"d58771\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/onclick\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d58771' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>A basis for web application event driven programming strategies references &#8230; element nesting and inheritance &#8230; the default event propagation up through the element hierarchy Of course you can ignore how this event &#8220;bubbling&#8221; can be harnessed, and indeed, we &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/onclick-event-propagation-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":[2397,4291,354,400,564,576,608,652,2621,4290,861,4288,3341,997,2786,4289,4287,1319],"class_list":["post-58771","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-bubble","tag-bubbling","tag-dom","tag-event","tag-hierarchy","tag-html","tag-inheritance","tag-javascript","tag-nesting","tag-nursery-rhyme","tag-onclick","tag-poem","tag-poetry","tag-programming","tag-propagation","tag-rhyme","tag-sestet","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/58771"}],"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=58771"}],"version-history":[{"count":5,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/58771\/revisions"}],"predecessor-version":[{"id":58776,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/58771\/revisions\/58776"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=58771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=58771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=58771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}