JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Element.onfocus() Handler

Name

Element.onfocus() Handler---invoked when a form element gains focus

Availability

Navigator 2.0, Internet Explorer 3.0

Synopsis

element.onfocus

Description

The onfocus() event handler of a form element is invoked by the web browser when the user transfers the keyboard focus to that element. Note that it is not invoked when focus is programmatically transfered with the focus() method.

The onfocus() event handler is a function defined through the onFocus attribute of the HTML tag that defined the element. The value of this attribute is a string that may contain any number of JavaScript statements, separated by semicolons. In Navigator 3.0, the onfocus() event handler may also be defined by assigning a function directly to the onfocus property of the element.

The onfocus() event handler is available for all form elements except the Hidden element. For Navigator 2.0 and 3.0 on Unix platforms, however, it is only invoked for the text-entry elements: Text, Textarea, Password and FileUpload. Note that in Navigator 3.0, the Window object also defines an onfocus() event handler.

See Also

"Element", "Element.onblur()", "Element.onchange()", "Element.onclick()"


Previous Home Next
Element.onclick() Book Index Element.options[]

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell
This HTML Help has been published using the chm2web software.