x
 
<!DOCTYPE html>
<html>
<body>
<p>请在文本字段中写一些东西,然后按重置按钮。</p>
<form onreset="myFunction()">
  <input type="text" id="myInput">
  <input type="reset">
</form>
<script>
function myFunction() {
  var x = document.getElementById("myInput");
  alert("Before reset, the text was: " + x.value);
}
</script>
</body>
</html>