HTML and CSS Reference
In-Depth Information
EXPLANATION
(
CONTINUED
)
6
The form's input type is a textbox. This is where the user will enter his or her guess.
7
This input type is a button.
8
When the user clicks this button, the
onClick
event handler is triggered, causing
the
guessit()
function to be called with
this
form as an argument. The display is
shown in Figures 13.26 and 13.27.
Figure 13.26
The user makes a guess (left), but is told he or she guessed wrong (right).
Figure 13.27
Focus returns to the form field.
The error event fires when a JavaScript error has occurred (window) or when an image
cannot be found (image elements).
EXAMPLE
13.20
<html>
<head><title>Wake up call</title>
<script type="text/javascript">
function wakeupCall(){ //
Function is defined here
timeout=setTimeout('alert("Time to get up!")',2000);
}