<SCRIPT type="text/javascript">
//Function to set the default value for the passed object
function setDefaultValue(inputObj)
{
if(inputObj.type == "text")
{
inputObj.value="";
}
else if((inputObj.type).substr(0, 6) == "select")
{
inputObj.selectedIndex=0;
}
}
function $(element)
{
return document.getElementById(element);
}
</SCRIPT>
I've implemented the above function just only for text field and drop down. You can even extend this functionality for other HTML form fields as well. Here is an example - give a try
This program has been tested on all the major browsers like IE >= 6.0, Mozilla >= 2.0 and Google chrome...