重置表单时,将触发onreset 属性。您可以尝试运行以下代码以实现onreset属性-
<!DOCTYPE html> <html> <body> <form onreset = "display()"> Student Name:<br> <input type = "text" name = "sname"> <br> Student Subject:<br> <input type = "text" name = "ssubject"> <br> <input type = "reset" value = "reset"> </form> <script> function display() { alert("表格重置成功!"); } </script> </body> </html>