|
【目录】 【上一页】 【下一页】 【索引】
onFocus
Executes JavaScript code when a focus event occurs; that is, when a window, frame, or frameset receives focus or when a form element receives input focus.
事件适用对象 | Button, Checkbox, FileUpload, Layer, Password, Radio, Reset, Select, Submit, Text, Textarea, Window | 实现版本 | Navigator 2.0 Navigator 3.0: event handler of Button, Checkbox, FileUpload, Frame, Password, Radio, Reset, Submit, and Window Navigator 4.0: event handler of Layer |
语法
onFocus="handlerText"
参数
描述
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.
使用的事件属性
示例
The following example uses an onFocus handler in the valueField Textarea object to call the valueCheck function.
<INPUT TYPE="textarea" VALUE="" NAME="valueField" onFocus="valueCheck()">
See also示例 for onBlur.
参看
onBlur, onChange
要获得关于事件句柄的常规信息,请看“事件的常规信息”。
要获得关于事件对象的信息,请看事件。
【目录】 【上一页】 【下一页】 【索引】
|