I have a form that has default values that describe what should go in the field (replacing the label). When the user focuses the field called by this function:
function clear_input(element)
{
element.value = "";
element.onfocus = null;
}
Onfocus is set to null, so if the user puts something in the field and decides to change it, their input is not deleted (therefore, it is only erased once). Now, if the user moves to the next field without entering any data, the default value is restored using this function (called onblur):
function restore_default(element)
{
if(element.value == '')
{
element.value = element.name.substring(0, 1).toUpperCase()
+ element.name.substring(1, element.name.length);
}
}
, , name. , , onfocus clear_input, .
element.onfocus = "javascript:clear_input(this);";
restore_default, . ?
Logan Serman