JavaScript实现重置表单(reset)的方法

转自:https://www.jb51.net/article/63305.htm

 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4 <script>
 5 function formReset()
 6 {
 7 document.getElementById("frm1").reset();
 8 }
 9 </script>
10 </head>
11 <body>
12 <p>Enter some text in the fields below, 
13 then press the "Reset form" button to reset the form.</p>
14 <form >
15 First name: <input type="text" name="fname"><br>
16 Last name: <input type="text" name="lname"><br><br>
17 <input type="button" onclick="formReset()" value="Reset form">
18 </form>
19 </body>
20 </html>