August 1999
Intermediate to advanced
1488 pages
72h 53m
English
text.focus()
The focus() method of the Text object gives focus to the text box. Be careful when using this method in conjunction with the Text.blur() method. It can lead to a focus/blur loop, where the browser blurs a focus as soon as it is done, and vice versa.
Listing 7.495 has two text boxes and two buttons. If the user clicks the first button, the cursor is set inside the first text box. If the user clicks the second text box, the cursor is set inside the second text box.
<html> <head> <script language="JavaScript"> <!-- Hide // Define the setFocus function called ... |
Read now
Unlock full access