编辑下面的代码:【加编码】
<html> <body> <p>该实例演示了如何向表单元素添加 "onreset" 事件。</p> <p>当表单被重置后,触发函数并弹出提示信息。</p> <form onreset="myFunction()"> 输入您的名字: <input type="text"> <input type="reset"> </form> <p id="demo"></p> <script> function myFunction() { document.getElementById("demo").innerHTML = "表单已被重置"; } </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂