Formular submit()Methode
Form-Objekt
Definition und Verwendung
Die submit()-Methode wird verwendet, um das Formular abzusenden (klicken Sie auf die Schaltfläche „Senden“).
Syntax
formObject.submit()
Browser-Unterstützung
![]()
![]()
![]()
![]()
![]()
Alle wichtigen Browser unterstützen die submit()-Methode.
Beispiel
Beispiel
Erstellen Sie eine Schaltfläche zum Absenden eines Formulars:
<html>
<head>
<script>
function formSubmit()
{
document.getElementById("frm1").submit();
}
</script>
</head>
<body>
<form id="frm1" action="form_action.html">
Vorname: <input type="text" name="fname"><br>
Nachname: <input type="text" name="lname"><br>
<input type="button" onclick="formSubmit()" value="Formular absenden">
</form>
</body>
</html>
<head>
<script>
function formSubmit()
{
document.getElementById("frm1").submit();
}
</script>
</head>
<body>
<form id="frm1" action="form_action.html">
Vorname: <input type="text" name="fname"><br>
Nachname: <input type="text" name="lname"><br>
<input type="button" onclick="formSubmit()" value="Formular absenden">
</form>
</body>
</html>
Selbst ausprobieren »
Formularobjekt Weitere Erweiterungen