提交表單時(shí)會(huì)觸發(fā) onsubmit
屬性事件。
沒有。
<form onsubmit="script">
<form>, <keygen>
onsubmit |
Yes | Yes | Yes | Yes | Yes |
<!DOCTYPE html>
<html>
<body>
<form action="a.php" onsubmit="myFunction()">
Enter name: <input type="text" name="fname">
<input type="submit" value="Submit">
</form>
<script>
function myFunction() {
console.log("The form was submitted");
}
</script>
</body>
</html>
更多建議: