We would like to know how to reset a form on page load.
<!-- www . j av a2 s.co m-->
<html>
<head>
<script type="text/javascript" language="javascript">
function ClearForm(){
console.log("reset");
document.MyForm.reset();
}
</script>
</head>
<body onload="ClearForm()">
<form name="MyForm" action="" method="Post">
First Name:<input type="text" name="FirstName"/>
Last Name:<input type="text" name="LastName"/>
User Number:<input type="text" name="UserNo"/>
<input type="submit" value="Submit Form"/>
</form>
</body>
</html>
The code above is rendered as follows: