Forum Moderators: open
<div style="width:500px;">
<form action="" method="get">
If the field below receives focus, the default text will clear out.
When the field loses focus, if user has not entered any text in to the box,
it will revert back to it's original value,
else it will keep whatever value user has entered.
Remove the onblur attribute if you don't want it to revert back to it's original value in the event of non-entry by user<br>
<input type="text" value="some default value" onfocus="this.value='';" onblur="if (this.value == '') {this.value = this.defaultValue;}">
</form>
</div>
<input type="text" value="some default value" onfocus="if (this.value == this.defaultValue) {this.value='';}" onblur="if (this.value == '') {this.value = this.defaultValue;}">