HTML and CSS Reference
In-Depth Information
3. Scroll back up to the peek() function and insert the following statements at the
end of the function to hide the puzzle hints after a half-second delay (see
Figure 13-26):
/* Remove the hints after 0.5 seconds */
setTimeout(“unpeek()”, 500);
Figure 13-26
triggering the unpeek() function
4. Save your changes to the file, and then reload the hanjie.htm file in your Web
5. Enter the same mistakes shown earlier in Figure 13-24, and then click the Peek!
button. Verify that the mistakes are highlighted in the puzzle and then rehidden
after a half-second delay.
Removing an Inline Style
When users want to give up, you want them to be able to click the Show Solution button
to display the complete puzzle solution. To display the solution, you must remove all of
the inline style attributes used to set the background color. Once those are removed, the
table cell backgrounds will be based on the style rules previously defined in the hanjie.
css external style sheet, which, as you saw in the first session, displays the complete
puzzle solution. To remove a style value, you'll set the value to an empty text string as in
the command
object .style. property = “”;
where object and property are references to the document object and the style prop-
erty name, respectively. You'll create the showSolution() function now to loop through all
of the data cells in the hanjie puzzle and remove their background-color styles, and then
apply that function to the onclick event of the Show Solution button.
Search WWH ::

Custom Search