Basically, this loop is composed of a function, “hideDivs” with a variable “showMe” passed into it (That’s only important later.) The for part basically states that the code should execute ten times, and modify the element with the ID “i” (The DIVs increasing in order) The modification in question is to set the display type to “none”.
This is where “showMe” comes into play. The for loop hides all of our DIVs, so we need to tell the function to set the DIV we pass to it to be viewable by setting its display type to “block”. Where do we tell the function what the variable showMe is? In the function call in our clickable SPAN! (That’s what I used, anyway.)
These SPANs sort of function as links, with an onClick statement and the number of the DIV that it “links” to. That number in parenthesis is what gets passed to the function we created earlier, and its purpose is to tell that function to set the display type to “block” for the number of the DIV we’re linking to.