{"id":39688,"date":"2018-07-25T03:01:01","date_gmt":"2018-07-24T17:01:01","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=39688"},"modified":"2018-07-25T17:53:13","modified_gmt":"2018-07-25T07:53:13","slug":"who-am-i-game-linked-iframe-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/who-am-i-game-linked-iframe-tutorial\/","title":{"rendered":"Who Am I Game Linked Iframe Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/HTMLCSS\/who_am_i.htm\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Who Am I Game Linked Iframe Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/who_am_i_more.jpg\" title=\"Who Am I Game Linked Iframe Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Who Am I Game Linked Iframe Tutorial<\/p><\/div>\n<p>Today&#8217;s work adds functionality onto yesterday&#8217;s <a title='Who Am I Game Primer Tutorial' href='#waigpt'>Who Am I Game Primer Tutorial<\/a>, allowing for this game to involve two players.  Two players using the one computer or device?  We do this today by making use of the HTML (textbox) <a target=_blank title='HTML input type=password information from w3schools' href='https:\/\/www.w3schools.com\/tags\/att_input_type_password.asp'>input element type=password<\/a>, that when used, given a non-snooping second player, allows for a second player to type in a name of a person for the other player to try and guess the name of, so long as that person has two words in their name and appears in a reasonably standard way on <a targe=_blank title='Wikipedia' href='http:\/\/wikipedia.org'>Wikipedia<\/a> &#8230; thanks again.  Obviously, no programmer can think up names of interest nearly as well as you users out there, we figure, and this is one motivation for the changes, though if you read below, there are other ideas to take home from today&#8217;s work.<\/p>\n<p>In our &#8220;nesting&#8221; frame of mind lately, a technique used to make this happen is like a &#8220;linked list&#8221; of HTML iframe children &#8220;slapped&#8221; on top of their parent in an <a target=_blank title='Overlay blog posts' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/overlay'>overlay<\/a> methodology making the parent totally transparent (ie. opacity=0) just before &#8220;slapping over&#8221; the child iframe with an increased z-index property and styled also with position:absolute;top:0px;left:0px;width:100%;height:100vh; and the score passed along in a URL, importantly, hidden from a non-snoopy competitor as this URL does not reach the address bar of the browser.  Just because the parent effectively becomes invisible does not stop it being accessible to fill out that, best hidden, final clue &#8230;<\/p>\n<p><code><br \/>\nMy name is Xavier Xenon.<br \/>\n<\/code><\/p>\n<p> &#8230; or some such.  In the design of the game, this final clue is a necessary part of the data structure that makes the game&#8217;s webflow work.<\/p>\n<p>And what of looking up Wikipedia for information about player nominated people?  The technique used here is <a target=_blank title='jQuery Ajax information' href='http:\/\/api.jquery.com\/jquery.ajax\/'>jQuery Ajax<\/a>, enabling the use of PHP code called but not part of any HTML iframe &#8220;child&#8221; arrangements.<\/p>\n<p>Get a friend and feel free to try <a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/HTMLCSS\/who_am_i.html--GETME\" title=\"who_am_i.htm\">who_am_i.htm<\/a>&#8216;s <a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/HTMLCSS\/who_am_i.htm\" title=\"Click picture\">live run<\/a>&#8216;s game of &#8220;Who Am I?&#8221;.  We developed it from yesterday&#8217;s work in <a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/who_am_i.html--GETME\" title=\"who_am_i.html\">this way<\/a>.<\/p>\n<hr>\n<p id='waigpt'>Previous relevant <a target=_blank title='Who Am I Game Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/who-am-i-game-primer-tutorial\/'>Who Am I Game Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/who_am_i.html\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Who Am I Game Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/who_am_i.jpg\" title=\"Who Am I Game Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Who Am I Game Primer Tutorial<\/p><\/div>\n<p>Today&#8217;s Who Am I Game makes use of the &#8220;linked list&#8221; feel, and event propogation features of yesterday&#8217;s <a title='HTML a Link innerHTML Extender and Event Propogation Primer Tutorial' href='#htmllhtmleeppt'>HTML a Link innerHTML Extender and Event Propogation Primer Tutorial<\/a> with the way in which it scores points for the game.<\/p>\n<p>The aim of the game is to guess who we are talking about with the game clues, the fewer the number of clues you need to solve the person&#8217;s name, the more you score.<\/p>\n<p>Feel free to try <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/who_am_i.html-GETME\" title=\"who_am_i.html\">who_am_i.html<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/who_am_i.html\" title=\"Click picture\">live run<\/a>&#8216;s game of &#8220;Who Am I?&#8221;.  We developed it from yesterday&#8217;s work in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/who_am_i.html-GETME\" title=\"who_am_i.html\">this way<\/a>.<\/p>\n<p>There you will note our use of a multi-dimensional array of clues (an array of clues for each person of interest, within that multi-dimensional array we call &#8220;clues&#8221;), and see that those arrays within an array don&#8217;t all have to be the same length, reflecting the fact that we don&#8217;t have the same number of clues for our people we are asking you to guess the name of.<\/p>\n<hr>\n<p id='htmllhtmleeppt'>Previous relevant <a target=_blank title='HTML a Link innerHTML Extender and Event Propogation Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/html-a-link-innerhtml-extender-and-event-propogation-primer-tutorial\/'>HTML a Link innerHTML Extender and Event Propogation Primer Tutorial<\/a> is shown below.<\/p>\n<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<hr>\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='#d39676' onclick='var dv=document.getElementById(\"d39676\"); dv.innerHTML = \"<iframe width=670 height=600 src=\" + \"\/\/www.rjmprogramming.com.au\/ITblog\/tag\/games\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d39676' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\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='#d39688' onclick='var dv=document.getElementById(\"d39688\"); dv.innerHTML = \"<iframe width=670 height=600 src=\" + \"\/\/www.rjmprogramming.com.au\/ITblog\/tag\/ajax\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d39688' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Today&#8217;s work adds functionality onto yesterday&#8217;s Who Am I Game Primer Tutorial, allowing for this game to involve two players. Two players using the one computer or device? We do this today by making use of the HTML (textbox) input &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/who-am-i-game-linked-iframe-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":[2,12,14,15,37],"tags":[69,2525,476,477,576,587,652,663,703,2621,876,894,2411,997,1319,1431,1496],"class_list":["post-39688","post","type-post","status-publish","format-standard","hentry","category-ajax","category-elearning","category-event-driven-programming","category-games","category-tutorials","tag-ajax","tag-child","tag-game","tag-games-2","tag-html","tag-iframe","tag-javascript","tag-jquery","tag-linked-list","tag-nesting","tag-opacity","tag-overlay","tag-parent","tag-programming","tag-tutorial","tag-wikipedia","tag-z-index"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/39688"}],"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=39688"}],"version-history":[{"count":5,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/39688\/revisions"}],"predecessor-version":[{"id":39714,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/39688\/revisions\/39714"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=39688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=39688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=39688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}