We can submit forms in following two ways in an HTML page:
Where formname is the name of the form which is to be submitted.
Description of code:
To illustrate the submit() method we have created a form named "frm". When we click on the link in this form, it calls the function submitForm() defined in the <script> tags. This function at last submits the form by calling submit() method with the form element reference object and simultaneously it moves to the "SuccessPage.html" as we have defined in the action attribute of the form tag. Full HTML code is as follows :
Click on the link "Submit Form"
It goes to the SuccessPage.html as a result to the submission of form. We can also come back to the previous page by clicking on the link "Go Back".