x
 
<!DOCTYPE html>
<html>
<body>
<p>本例演示如何将 "onreset" 事件分配给 form 元素。</p>
<p>当您重置表单时,会触发输出文本的函数。</p>
<form onreset="myFunction()">
  Enter name: <input type="text">
  <input type="reset">
</form>
<p id="demo"></p>
<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "The form was reset";
}
</script>
</body>
</html>