首页javascriptsubmit_buttonJavascript Form - 如何调用form.reset()和form.submit()重置和提交表单的方法

Javascript Form - 如何调用form.reset()和form.submit()重置和提交表单的方法

我们想知道如何调用form.reset()和form.submit()重置和提交表单的方法。


<html> 
<body> 
<form name="entries" method="POST" action=""> 
First name:<input type="text" name="firstName" id="firstName" /> 
<p>Last name:<input type="text" name="lastName" id="lastName" /></p> 
<p>Address:<input type="text" name="address" id="address" /></p> 
<p>City:<input type="text" name="city" id="city" /></p> 
<p><input type="radio" name="gender" id="gender1" checked="checked"/>Male 
<input type="radio" name="gender" id="gender2" />Female</p> 
<p><input type="checkbox" name="retired" id="retired" />I am retired</p> 
</form> 
<p><a href="javascript:document.forms[0].submit()">
  <img alt="image" src="http://www.w3cschool.cn/style/download.png" height="25" width="100" border="0" /></a> 
  <a href="javascript:document.forms[0].reset()">
  <img alt="image" src="http://www.w3cschool.cn/style/download.png" height="25" width="100" border="0" /></a></p> 

</body> 
</html>