Pages

Thursday, October 6, 2011

Select field contents when a field gains focus (FrontPage 2000/2002/2003)

When a user tabs into a form field, the browser automatically selects any data that appears in that field. If he clicks on the field, however, that's not the case.
With a miniscule amount of scripting, you can change that behavior, selecting a field's contents any time that field gains focus. Doing so is a good idea whenever you've pre-filled a field with sample data. To do this, switch to HTML/Code mode and add onfocus="this.select()" to the field's <input> or <textarea> tag, as shown in these examples:

<input type="text" name="home_phone" size="12"
  value="555-555-1212" onfocus="this.select()">
<textarea rows="2" name="S1" onfocus="this.select()" cols="20">


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.