Advanced event handling
onload event applies to the
tag, and it runs after the page has finished loading.
by accessing HTML elements and using
element.onclick = "alert('Alert me!');" does not work.
When an event fires, the event handler function receives an event
object describing information about the event.
Browsers disagree on the naming of these fields, but for non-IE browsers,
target field contains the event which received the action:
Interacting with CSS
CSS is a means for separating the content of a web page from the
style of a web page.
a literal field, or as a an index.
For example, one can render the following page:
by accessing all of the styles as fields:
or by accessing all of the styles as indexes:
"camel case"; for example,
Below, you'll find a partially constructed Minesweeper game.
The code creates the board with DOM tree manipulation, and stores
information about the game inside the DOM tree.
It randomly initializes the board with mines.
At the moment, it calls the procedure
when it starts, which overlays information on the board.
(If you want, have
DisplayDebugInfo invoked when the user
presses the character "C".)
You can decide on the precise controls, but it's recommend that a user should be able to highlight a cell, and click "F" to toggle the flag, or "B" to "clear" the cell.
For simplicity, you can use blue to mark a cell as flagged. If you're feeling adventurous, add some graphics!