html重置功能

<html>
<head>
<script type="text/javascript">
function formReset()
  {
  document.getElementById("myForm").reset()
  }
</script>
</head>
<form id="myForm">
Name: <input type="text" size="20"><br />
Age: <input type="text" size="20"><br />
<br />
<input type="button" onclick="formReset()" value="Reset">
</form>
</body>
</html>

语法:
formObject.reset()

注释:
reset()方法针对form标签,页面中得有<from></from>标签,才起作用。 



http://www.w3school.com.cn/jsref/met_form_reset.asp

原文地址:https://www.cnblogs.com/Ly426/p/9791067.html