{"id":21312,"date":"2016-04-16T03:01:20","date_gmt":"2016-04-15T17:01:20","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=21312"},"modified":"2016-04-16T07:14:18","modified_gmt":"2016-04-15T21:14:18","slug":"javascript-dynamic-scheduled-function-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/javascript-dynamic-scheduled-function-primer-tutorial\/","title":{"rendered":"Javascript Dynamic Scheduled Function Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/settf.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Javascript Dynamic Scheduled Function Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/settf.jpg\" title=\"Javascript Dynamic Scheduled Function Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Javascript Dynamic Scheduled Function Primer Tutorial<\/p><\/div>\n<p>Today&#8217;s very generic HTML and Javascript tutorial has two major &#8220;lessons&#8221;, if you will.  They are &#8230;<\/p>\n<ol>\n<li>the Javascript <a target=_blank title='Javascript setTimeout method information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/met_win_settimeout.asp'><i>setTimeout<\/i><\/a> (and <a target=_blank title='Javascript setInterval method information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/met_win_setinterval.asp'><i>setInterval<\/i><\/a>) parameter 1 <i>function<\/i> parameters do not have to point to static Javascript functions &#8230; the parameter 1 can be dynamic in nature, or just known, as with today&#8217;s <code>setTimeout(function(){ top.document.getElementById('nothingp').innerHTML+=eval(zero % 10); }, 500);<\/code><\/li>\n<li>(we&#8217;ve done this many times before already, but just reiterating that) the same codeset (in today&#8217;s case HTML\/Javascript) can run a (several-)tiered scenario of application, as with today&#8217;s two-tiered arrangement of <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/settf.html_GETME\" title='settf.html'><i>settf.html<\/i><\/a> (parent HTML) calling (child HTML) <a target=_blank title='HTML iframe element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_iframe.asp'>iframe<\/a> <i>settf.html<\/i>?called=y &#8230; where the <i>&#8220;child&#8221;<\/i> can know the <i>&#8220;parent&#8221;<\/i>&#8216;s document as <i>top<\/i>.document &#8230; and in this way can control every dynamic aspect of the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/settf.html\" title='Click picture'>project<\/a>, if you wish<\/li>\n<\/ol>\n<p>The first point above is pretty important, and we may revisit this with a more complex example later, because it means you can gain some knowledge as the web application process proceeds, and tailor how you run scheduled tasks as the information comes in, allowing for real time programming thoughts to be called into play.<\/p>\n<p>So today we just have a &#8220;counter&#8221; being controlled by the user via a press of an HTML <a target=_blank title='HTML button element information from wschools' href='http:\/\/www.w3schools.com\/tags\/tag_button.asp'>button<\/a> element, the &#8220;display&#8221; of which is in the &#8220;parent&#8221; realm, but the &#8220;onclick&#8221; logic of which is being processed by the child HTML iframe&#8217;s incarnation of your HTML code, that &#8220;slaps&#8221; the display back up to the parent via the use of <i>top<\/i>.document (blah blah blah).<\/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='#d21312' onclick='var dv=document.getElementById(\"d21312\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/settimeout\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d21312' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Today&#8217;s very generic HTML and Javascript tutorial has two major &#8220;lessons&#8221;, if you will. They are &#8230; the Javascript setTimeout (and setInterval) parameter 1 function parameters do not have to point to static Javascript functions &#8230; the parameter 1 can &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/javascript-dynamic-scheduled-function-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":[1849,576,587,652,997,1125,1126,1319],"class_list":["post-21312","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-coding","tag-html","tag-iframe","tag-javascript","tag-programming","tag-setinterval","tag-settimeout","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/21312"}],"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=21312"}],"version-history":[{"count":10,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/21312\/revisions"}],"predecessor-version":[{"id":21329,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/21312\/revisions\/21329"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=21312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=21312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=21312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}