August 1999
Intermediate to advanced
1488 pages
72h 53m
English
text.select()The select() method of the Text object selects the text in the text box. Be careful when using this method in conjunction with the blur() and focus() methods. It can lead to a focus/blur loop where the browser blurs or focuses as soon as it is has been selected, and vice versa.
Listing 7.503 has a text box and a button. If the user clicks the button, the text inside the text box will be highlighted. Notice the focus() method had to be used to tell the browser to actually highlight the text.
<html> <head> <script language="JavaScript"> <!-- Hide // Define the selectText ... |
Read now
Unlock full access