HANGMAN
Code Explanation
d.innerHTML = "
Sets the contents to be a div of class
blanks, with the id of the word the uniqueid
just created. The text content will be an
underscore.
document.body.appendChild(d); Appends the created element as a child of the
body
thingelem = document.getElementById
(uniqueid);
Gets the created element
x = secretx + secretwidth*i; Calculates the elements horizontal position
y = secrety; Sets its vertical position
thingelem.style.top = String(y)+"px"; Using the style top, sets the vertical position
thingelem.style.left = String(x)+"px"; Using the style left, sets the horizontal
position
} Closes the for loop
steps[cur](); Draws the first function in the steps list, the
gallows
cur++; Increments cur
return false; Returns false to prevent any refreshing of
the HTML page
} Closes the function
function pickelement(ev) { Header for the function invoked as a result of
a click
var not = true; Sets not to true, which may or may not be
changed
var picked = this.textContent; Extracts the text content, namely the letter,
from the object this references
var i; Iterates