| Event handler for |
Button, Checkbox, FileUpload, Layer, Password, Radio, Reset, Select, Submit, Text, Textarea, Window
|
| Implemented in |
Navigator 2.0 Navigator 3.0: event handler of Button, Checkbox, FileUpload, Frame, Password, Radio, Reset, Submit, and WindowNavigator 4.0: event handler of Layer
|
Syntax
onFocus="handlerText"
Parameters
| JavaScript code or a call to a JavaScript function. |
Description
The focus event can result from a focus method or from the user clicking the mouse on an object or window or tabbing with the keyboard. Selecting within a field results in a select event, not a focus event. onFocus executes JavaScript code when a focus event occurs.
A frame's onFocus event handler overrides an onFocus event handler in the BODY tag of the document loaded into frame.
Note that placing an alert in an onFocus event handler results in recurrent alerts: when you press OK to dismiss the alert, the underlying window gains focus again and produces another focus event.
Note
In Navigator 3.0, on some platforms, placing an onFocus event handler in a
FRAMESET tag has no effect.
Event properties used
type | Indicates the type of event. |
target | Indicates the object to which the event was originally sent. |
Examples
The following example uses an onFocus handler in the valueField Textarea object to call the valueCheck function.
<INPUT TYPE="textarea" VALUE="" NAME="valueField"
See also examples for
onFocus="valueCheck()">onBlur.
For general information on event handlers, see "General Information about Events".
For information about the event object, see event.
Last Updated: 10/31/97 16:34:02