HTML-DOM-Formular einreichen () -Methode
Definition und Verwendung
submit () Methode verwendet wird, um die Form zu bestätigen (klicken Sie auf die Schaltfläche Senden).
Grammatik
formObject.submit()
Browser-Unterstützung
Alle gängigen Browser unterstützen () Methode einreichen
Beispiele
Beispiele
Erstellen Sie ein Formular-Taste:
<html>
<head>
<script>
function formSubmit()
{
document.getElementById("frm1").submit();
}
</script>
</head>
<body>
<form id="frm1" action="form_action.html">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="button" onclick="formSubmit()" value="Submit form">
</form>
</body>
</html>
<head>
<script>
function formSubmit()
{
document.getElementById("frm1").submit();
}
</script>
</head>
<body>
<form id="frm1" action="form_action.html">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="button" onclick="formSubmit()" value="Submit form">
</form>
</body>
</html>
Versuchen »
Form Object