HTML and CSS Reference
In-Depth Information
Figure 13.16 Three buttons waiting for a user to click one of them.
Figure 13.17 The user clicked the Night button.
13.6.4 Forms and the onFocus and onBlur Event Handlers
The onFocus event handler is triggered when a form element has focus: The cursor is sit-
ting in the box, waiting for key input or in the case of a button, for the Enter key to be
pressed. The onBlur event is triggered when the form element loses focus, when the cur-
sor is moved away from the input device.
EXAMPLE 13.15
<html>
<head><title>Using the onFocus Event Handler</title>
<script type="text/javascript">
1
function handler(message) {
2
window.status = message;
// Watch the status bar
}
</script>
</head>
<body bgcolor="magenta"><b>The onFocus Event Handler
<i>(When you click in one of the boxes, focus goes
to the status bar)</i>
Continues
 
 
Search WWH ::




Custom Search