Blank out default field value when a field gets focus and reset if field looses focus blank.

This functionality saves your users time from having to remove the default placeholder value each time they go to populate the field. An date field example has been provided below. MM/DD/YYYY are pre-populated in the fields and automatically disappear when the cursor moves the the field. The code example below was used on the "YYYY" field and the "this" handle allows you drop this code in any field without having to have specific field references.
JavaScript


onFocus="if (this.value=='yyyy') { this.value='' }"
onBlur="if (this.value=='') { this.value='yyyy'}"

Images/Screenshots:


Posted by fbrefere001 on Monday February 21, 2005