Share this page 

Suggest a form valueTag(s): Form


When you click inside the text box, you will see that the text disappears.
<script language="Javascript">
<!--
function doClear(theText) {
  if (theText.value == theText.defaultValue) {
    theText.value = ""
    }
}
//-->
</script>
<form>
<input type="text" size=15 value="Try it here" onFocus="doClear(this)">
</form>

Or you can keep (and select) the default value :

<script language="Javascript">
<!--
function doSelect(theText) {
  if (theText.value == theText.defaultValue) {
    theText.select();
    }
}
//-->
</script>

<input type="text" value="Try it here" onfocus="doSelect(this)">