Submit.onFocus

JavaScript1.0+, JScript1.0+ Nav2+, IE3+, Opera3+ Syntax

onFocus="command"

Description

The onFocus event handler of an instance of a Submit object is fired when focus is set to that particular submit button. Care should be taken when using this event handler, because it is possible to get into an infinite loop when using the onBlur event handler or blur() method.

Example

Listing 7.488 contains two text boxes and a submit button. The submit button has the Focus event intercepted within its tag. The second text box is used for a counter for the number of times the onFocus event handler is fired.

In the script, the event calls a function that assigns the first text box focus. The result of this is that when a user tries to ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.