Tag Archives: innerHTML

HTML Square Horizontal Rule Plot Axes Tutorial

A lot of us have a goodly amount of “visual learner” in us, and the study of geometry or algebra or calculus in mathematics is full of opportunities for “visual cues” to topics that look a bit “dry” on paper. Take linear equations for instance … and I hear that the circus is a popular winner here. If we were to offer you … y = [Gradient]x + [Y-Offset] = 2x + 189 … as a linear equation to contemplate, can you imagine it in your mind as easily as to use the “visual cue” of today’s tutorial picture? It asks this of the user information wise … user enters minimumX,minimumY,maximumX,maximumY for a range of interest for the plotting of the axes … perhaps a bit tricky … in today’s tutorial picture we entered -200,-200,200,200 … then … user enters gradient,y-offset … in today’s tutorial picture we entered 2,189 (for that linear equation above) Onto the recent HTML Square Horizontal Rule Tracing Image Reveal Game Tutorial we added the one new dropdown menu option “Plot Axes” to get to this functionality, so why not peruse the HTML and Javascript and CSS code of square_hr_tracing.htm‘s live run link. Previous relevant HTML Square Horizontal Rule Tracing Image Reveal Game Tutorial is shown below. Rest assured all of yesterday’s HTML Square Horizontal Rule Tracing iOS Mobile App Tutorial thoughts will continue on with any extended functionality with our “HTML Square Horizontal Rule Tracing” inspired web application’s dropdown list of games and puzzles. With that in mind, today’s extended functionality is an Image Revealing Game. Are you a regular, and know about our design belief in categorizing (a lot of) web design ideas into one of … overlay … and/or … reveal … concepts? Well, today, our Image Revealing Game uses a bit of both to create its workings. What’s the gist of the game? It’s a game for two players and the players take it in turns, with … One player picking an image via either … image URL … or browsed for image file on disk … and this image is the background image for the table element consisting of that 5×5 grid of the earliest days (still) of this project’s concepts … and … the other player is clicking on overlayed buttons placed on top of this image to reveal 1/100th (as each table cell has four such buttons) of the

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

HTML Square Horizontal Rule Tracing Image Reveal Game Tutorial

Rest assured all of yesterday’s HTML Square Horizontal Rule Tracing iOS Mobile App Tutorial thoughts will continue on with any extended functionality with our “HTML Square Horizontal Rule Tracing” inspired web application’s dropdown list of games and puzzles. With that in mind, today’s extended functionality is an Image Revealing Game. Are you a regular, and know about our design belief in categorizing (a lot of) web design ideas into one of … overlay … and/or … reveal … concepts? Well, today, our Image Revealing Game uses a bit of both to create its workings. What’s the gist of the game? It’s a game for two players and the players take it in turns, with … One player picking an image via either … image URL … or browsed for image file on disk … and this image is the background image for the table element consisting of that 5×5 grid of the earliest days (still) of this project’s concepts … and … the other player is clicking on overlayed buttons placed on top of this image to reveal 1/100th (as each table cell has four such buttons) of the image, and at any time, via the “guess” HTML “a” link means of guessing what the image contains, a correct guess, as judged by the first (image choosing) player scores that guessing player (100 – number of clicked buttons) points To test this new game out, you could try today’s changed square_hr_tracing.htm‘s Image Revealing Game live run. Previous relevant HTML Square Horizontal Rule Tracing iOS Mobile App Tutorial is shown below. The design of our recent “HTML Square Horizontal Rule Tracing” suite of functionalities, with their navigational arrangements using … web browser (address bar) URL involving ? and & arguments … and … hashtags (using #) … all possible, because the amounts of passed data is small (and so we don’t need to post to a serverside piece of code written in a language like PHP or Perl or Python (the three “P”‘s)), lends itself to (iOS) … on the iPad or iPhone in a web browser such as Safari … arrange navigation to a web application “snapshot” of the (game or puzzle or whatever) functionality of interest at its instigation … touch the Share link up near the top right … touch the “Add to Home Screen” button … fill in a suitable name (you can “long touch” Select All

Posted in eLearning, Event-Driven Programming, Games, Operating System, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

HTML Square Horizontal Rule Tracing iOS Mobile App Tutorial

The design of our recent “HTML Square Horizontal Rule Tracing” suite of functionalities, with their navigational arrangements using … web browser (address bar) URL involving ? and & arguments … and … hashtags (using #) … all possible, because the amounts of passed data is small (and so we don’t need to post to a serverside piece of code written in a language like PHP or Perl or Python (the three “P”‘s)), lends itself to (iOS) … on the iPad or iPhone in a web browser such as Safari … arrange navigation to a web application “snapshot” of the (game or puzzle or whatever) functionality of interest at its instigation … touch the Share link up near the top right … touch the “Add to Home Screen” button … fill in a suitable name (you can “long touch” Select All to effectively highlight what’s there already, ready) for the … icon you create in the Home Screen by touching the Add link at the top right Then, from then on, those icons you create in the Home Screen could be your instant access method of “Cutting to the Chase”. To show this, we used QuickTime Player on a MacBook Pro connected to an iPad by the (ubiquitous) Apple white lead via its New Movie Recording dropdown to “Robert’s iPad” option, to create a video called “iOS Mobile App and Web Application Nexus via Share’s Add to Home” uploaded to YouTube, and with the “blurb” … We demonstrate some web applications that use the one HTML and Javascript and CSS codeset partitioned off to many functionalities (such as games and puzzles) visited by a Safari web browser user the once, and at instigation, are hived off to iPad Home screen icons as iOS Mobile Apps to a large degree, via the Share link’s Add to Home. … that you can play for yourself below … … resulting in the (best part of, but nobody’s saying “totally”) iOS Mobile App looking icons pointing at … Hangman Game Chinese Brain Twisters Maths Grid Paper (sorry, but missed off in video, and done later via same methodology) SOS Game (as of day before yesterday’s HTML Square Horizontal Rule Tracing SOS Game Tutorial) Previous relevant HTML Square Horizontal Rule Tracing SOS Game Tutorial is shown below. The new development today on top of yesterday’s HTML Square Horizontal Rule Tracing Maths Grid Paper Tutorial is the

Posted in eLearning, Event-Driven Programming, Games, iOS, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

HTML Square Horizontal Rule Tracing SOS Game Tutorial

The new development today on top of yesterday’s HTML Square Horizontal Rule Tracing Maths Grid Paper Tutorial is the coding for a game we used to play at school called the SOS Game. If the grid is filled up and the number of SOSs for each player is the same, then the game is a draw. The game can also be played where the player who creates an SOS is the winner and if no SOSs are created the game is a draw. A technique that came into play with this as far as user interaction is concerned was to involve select (dropdown) elements (surprise, surprise) with “size=3″ for the three choices ” ” (initially) or “S” or “O”. Once the user makes a non-blank choice we adjust that select (dropdown) element’s innerHTML to still be a dropdown but just with your selected value, nullifying any duplicate “onchange” event logics, on the understanding that the “onchange” event can’t be fired from a select (dropdown) element with only one option subelement. This is a game designed for more than one player so we organize two players to play the game in turns. Here is the initial drawing of the SOS Game grid … function sosize() { var itds=0; tds=document.getElementsByTagName(‘td’); var sqsi=0, ioffset=0; document.getElementById(‘myh4′).innerHTML+=’ … turn of Player1′ + score1 + ‘ versus Player2′ + score2; for (var itrs=0; itrs<5; itrs++) { for (var itds=eval(5 * itrs); itds<eval(5 + eval(5 * itrs)); itds++) { thisrect=tds[itds].getBoundingClientRect(); tds[itds].style.verticalAlign=’top’; sqsi=eval(2 * itds + ioffset); tds[itds].innerHTML='<select title=”” style=vertical-align:top;width:50%;height:50%;text-align:center; size=3 id=sqsi’ + sqsi + ‘ onchange=sosmove(this);><option value=” “> </option><option value=”S”>S</option><option value=”O”>O</option></select>’; tds[itds].innerHTML+='<select title=”” style=vertical-align:top;width:50%;height:50%;text-align:center; size=3 id=sqsi’ + eval(1 + sqsi) + ‘ onchange=sosmove(this);><option value=” “> </option><option value=”S”>S</option><option value=”O”>O</option></select>’; tds[itds].innerHTML+='<br><select title=”” style=vertical-align:bottom;width:50%;height:50%;text-align:center; size=3 id=sqsi’ + eval(10 + sqsi) + ‘ onchange=sosmove(this);><option value=” “> </option><option value=”S”>S</option><option value=”O”>O</option></select>’; tds[itds].innerHTML+='<select title=”” style=vertical-align:bottom;width:50%;height:50%;text-align:center; size=3 id=sqsi’ + eval(11 + sqsi) + ‘ onchange=sosmove(this);><option value=” “> </option><option value=”S”>S</option><option value=”O”>O</option></select>’; } ioffset+=10; } } Here is the analysis of a player’s SOS Game select (dropdown) element interaction … function checkifsos(t1, t2, t3) { //, camv) { //var score1=’ (0)’, score2=’ (0)’; //var amv=camv.split(‘.’)[0]; var retv=false; if (t1 >= 0 && t1 < 100 && t2 >= 0 && t2 < 100 && t3 >= 0 && t3 < 100) { if (document.getElementById(‘sqsi’ + t1).value == ‘S’ && document.getElementById(‘sqsi’ + t2).value == ‘O’ && document.getElementById(‘sqsi’ + t3).value == ‘S’) { if (thisplayer == 1) { document.getElementById(‘sqsi’

Posted in eLearning, Event-Driven Programming, Games, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

HTML a Link innerHTML Extender and Event Propogation Primer Tutorial

Guess the recent PDF Attachments Add Page Tutorial got me in the mood for “nesting”, and a curiosity I’ve always had, but never “implemented”, is to do a Javascript DOM thing that feels a lot like “linked list” work and involving an HTML “a” link’s innerHTML property. Today’s tutorial picture, we are hoping, is “worth a thousand words”, because this is a bit esoteric explaining purely in words, but will try as a “stepped set of instructions” below … start with a “a” link that looks as below … <a title=’Show me’ style=’text-decoration:underline;cursor:pointer;’ id=’origsnake1′ onclick=”show(‘tdsnake’,this);”>Snakes … </a> allow for user interaction that offers you to extend that “a” link’s wording as per the HTML … <input type=text id=’iadd’ value=”></input> <input style=’background-color:yellow;’ onclick=”addthis(document.getElementById(‘iadd’));” type=’button’ value=’Add…’></input> clicking that button calls on the salient “linked list” feeling Javascript DOM code … var addto=’origsnake1′; function addthis(inputo) { var nextto=eval(1 + eval(addto.replace(‘origsnake’,”))); document.getElementById(addto).innerHTML+=”</a><a title=’Show me’ style=’text-decoration:underline;cursor:pointer;’ id=’origsnake” + nextto + “‘ onclick=\”show(‘tdsnake’,this);\”>” + inputo.value.replace(‘ … ‘,”).replace(‘ …’,”).replace(‘…’,”) + ” … “; addto=’origsnake’ + nextto; } and the user clicking on one of those “a” links calls on Javascript code … function show(supervisor,curo) { alert(“This innerHTML=” + curo.innerHTML + ” and the overall table cell innerHTML=” + document.getElementById(supervisor).innerHTML); } … that propogates up through the hierarchy of “a” links created on the fly this way Perhaps you are in “nesting” form too, and find a_extender.html‘s live run interesting too?! If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , | Leave a comment

HTML Table Cell Contenteditable Onload Tutorial

If you are a regular at this blog you’ll no doubt have tweaked that we are very keen to use Javascript’s document.body’s onload event to add flexibility to proceedings. Today, though, it is an awareness of a web application’s data control, controllable even before the document.body’s onload event that we want to remind you about. There are a few preonload ideas below, the first of which we make huge use of extending yesterday’s HTML Table Cell Contenteditable Tutorial‘s web application’s functionality, to add a whole lot more flexibility … you can process URL ($_GET[]) “get” arguments (those of the ?Name1=Value1 and &NameNot1=ValueNot1 ilk) ahead of the onload event (via document.URL) … but we choose to do it with the onload event today document.referrer referring webpage is available to you window object information can be available navigator object information can be available localStorage data information and HTTP cookies can be available jQuery has the … $( document ).ready(function() { console.log( “ready!” ); }); … syntax to use as soon as the document is ready to use (and consequently could involve jQuery Ajax $.ajax involvement, even) just after the <body> tag you can place <script type=’text/javascript’> … the timing of which is a bit indeterminate … but can include one of our favourite … document.write(prompt([wording],[default])); (prompting for content, off the user, and onto the webpage, on the fly) … </script> you can involve a serverside language like PHP as a whole layer on top not only working before document.body’s onload event but at a different part of the client/server messaging cycle … but perhaps we should just concentrate on the clientside options above for this discussion today, as a lot of us do not involve serverside thoughts in our thinking As much as we like to use document.write(prompt([wording],[default])) shaping to do it for today’s changes fell a bit short for our enthusiasm levels, so will just have to harp on about it today, or you can consult HTML/Javascript Clairvoyance Tester Mobile Tutorial for an example if you like. None the less, by the timing of the the document.body’s onload event, perhaps you have Javascript arrays defined between <head> and </head> but that doesn’t mean you necessarily have to settle on that (array) content, if you have been indicated to otherwise by a ($_GET[]) “get” arguments call to the contrary (and if you want to involve serverside then ($_POST[]) “post” data could have

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

HTML Table Cell Contenteditable Tutorial

Yesterday’s HTML div Contenteditable Form Tutorial was all about the global attribute contenteditable=true rather than about HTML div elements per se, hence the challenge we gave you … … (but perhaps you should broaden my horizons with feedback on other element types?!) … Well, with all those cards and letters rolling in (tee, hee) we’ve decided to see how it works with the “Table Cell” elements td and specifically th (for header table cell) today. Lo and behold, it works, and we show you today a deck of cards shuffled, then set on a timer that takes the card on top and puts in down the bottom of the deck to expose the next card, but you can show any card of your choosing, bucking this trend, by either … click/touch a card of interest down in the deck … or … define the image URL yourself via the HTML th contenteditable=true header table cell … to, similar to yesterday’s HTML iframe content change, is you, potentially, changing content again, this time for an HTML img element’s src property. Guess we’ll have to open those windows, and remember today’s HTML and Javascript and CSS table_ce.html‘s live run lesson. Previous relevant HTML div Contenteditable Form Tutorial is shown below. Are you like me, and think that the global attribute contenteditable=true can be incredibly useful, so far we’ve been thinking, with HTML div elements, in particular (but perhaps you should broaden my horizons with feedback on other element types?!). You could read more on some background to this at HTML div Versus hr Contenteditable Tutorial. But this HTML div contenteditable=true scenario would be useful in an HTML form, don’t you think? Can’t you imagine its multiple line characteristics as being a “flex” type replacement for the hardcoded col=? row=? of an HTML textarea element (the one chosen for multiple line textual data in most HTML form element scenarios)? So we, rather than ruining the fun of looking up whether this is possible via advice on the “net” wrote a small web application to try this out, and even bucking our “denial of service” thoughts couldn’t sway the reality that an HTML element innerHTML cannot, a form friend, be. You’ll notice with the HTML textarea element, though we do use the innerHTML property a lot, at least hereabouts, it also has a value property in keeping, apparently, with HTML form element requirements to

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

HTML div Contenteditable Form Tutorial

Are you like me, and think that the global attribute contenteditable=true can be incredibly useful, so far we’ve been thinking, with HTML div elements, in particular (but perhaps you should broaden my horizons with feedback on other element types?!). You could read more on some background to this at HTML div Versus hr Contenteditable Tutorial. But this HTML div contenteditable=true scenario would be useful in an HTML form, don’t you think? Can’t you imagine its multiple line characteristics as being a “flex” type replacement for the hardcoded col=? row=? of an HTML textarea element (the one chosen for multiple line textual data in most HTML form element scenarios)? So we, rather than ruining the fun of looking up whether this is possible via advice on the “net” wrote a small web application to try this out, and even bucking our “denial of service” thoughts couldn’t sway the reality that an HTML element innerHTML cannot, a form friend, be. You’ll notice with the HTML textarea element, though we do use the innerHTML property a lot, at least hereabouts, it also has a value property in keeping, apparently, with HTML form element requirements to involve the name property of form elements as … Name=Value … URL ? and & argument data pairings for method=GET and also accessible with serverside (PHP, for instance) as post data pairings, once the HTML form is submitted. So there’s the intervention point, we figured, on the HTML form’s onsubmit event, to try to do something about this, and combine … the user experience benefits, sometimes, to using HTML div contenteditable=true name=[Name] (with its innerHTML as Value) … rather than those HTML textarea elements … the navigational benefits of HTML form element Then it tweaked with us that HTML (within a form) like … Favourite Iframe: <div onblur=” if (typeof issrcchange === ‘function’) { issrcchange(this); }” style=’width:80%;height:60vh;display:inline-block;border:1px solid red;padding: 5px 5px 5px 5px;’ id=”diframe” name=”diframe” contenteditable=’true’><iframe style=”width:100%;height:60vh;” src=”knockout_dice_game.html”></iframe> … is knockout_dice_game.html</div> … not only involved a better user experience (you might boil all this down to, “look”) with the HTML div contenteditable=true but by the nature of an HTML div element we could work that … if (typeof issrcchange === ‘function’) { issrcchange(this); } … Javascript call allow for the user to change the HTML iframe element content (that even contenteditable=true doesn’t allow you to do) by arranging the HTML div element innerHTML’s last word point at that

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , | Leave a comment