Resetting a form on page load : Reset « Form « JavaScript Tutorial






<html>
<head>
<title>Resetting a form on page load</title>
<script type="text/javascript" language="javascript">
<!-- //
function ClearForm(){
    document.MyForm.reset();
}
// -->
</script>
</head>
<body onload="ClearForm()">
<table>
<form name="MyForm" action="http://www.java2s.com/" method="Post">
<tr>
 <td width="15%" align="right">First Name: </td>
 <td> <input type="text" name="FirstName"/></td>
</tr>
<tr>
 <td align="right">Last Name: </td>
 <td> <input type="text" name="LastName"/></td>
</tr>
<tr>
 <td align=""right">User Number: </td>
 <td> <input type="text" name="UserNo"/></td>
</tr>
<tr>
 <td>&nbsp;</td>
 <td> <input type="submit" value="Submit Form"/></td>
</tr>
</table>
</form>
</body>
</html>








10.25.Reset
10.25.1.Reset
10.25.2.Reset.blur()
10.25.3.Reset.click()
10.25.4.Reset.focus()
10.25.5.Reset.form
10.25.6.Reset.handleEvent()
10.25.7.Reset.name
10.25.8.Reset.onBlur
10.25.9.Reset.onClick
10.25.10.Reset.onFocus
10.25.11.Reset.type
10.25.12.Reset.value
10.25.13.Resetting a form on page load