JavaScript中onreset事件的用途是什么?
重置表单时,onreset事件很有用。您可以尝试运行以下代码以了解如何在JavaScript中实现onreset 事件-
示例
<!DOCTYPE html>
<html>
<body>
<script>
function resetFunct() {
alert("The form was reset");
}
</script>
<form onreset = "resetFunct()">
Enter age: <input type = "number"><br>
Enter birth month: <input type = "text"><br>
<input type = "reset">
</form>
</body>
</html>