Form submit()Method

Form 对象参考手册Form Object

Definition and Usage

The submit() method is used to submit the form (click the Submit button).

Syntax

formObject.submit()


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the submit() method.


Example

Example

Create a form submit button:

<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>

Try it Yourself »


Form 对象参考手册Form Object Other Extensions