November 25, 1999 - Highlighting Text Fields
November 25, 1999|
Highlighting Text Fields
Tips: November 1999
Yehuda Shiran, Ph.D.
select()method to highlight the input area of a text field. You can use the
select()method with the
focus()method to highlight the field and position the cursor for a user response. This makes it easy for the user to replace all the text in the field.
Here's the actual output:
highlight()function receives a reference of a text field (
<INPUT TYPE="text">) and invokes its
select()methods. When calling the function from a button, we refer to the form as
this.formbecause the button belongs to the same form as the text field. However, a link isn't a form element, so we must use absolute referencing (
Note that the
select() method is supported by all versions of Navigator and Internet Explorer except Internet Explorer 3.0x.