Submit.click() : submit button « Form « JavaScript Tutorial






The click() method simulates a click on the submit button. Note that if you have an onClick event handler assigned to this button, it will not be executed.

<html>
    <head>
    <script language="JavaScript">
    <!--
    function submitForm(){
      if(document.myForm.myText.value == ""){
        alert("Please enter some text first");
      }else{
        document.myForm.mySubmit.click();
      }
    }
    -->
    </script>
    </head>
    <body>
    <form name="myForm">
    Please Enter some text and click the link.<br>
      <input type=TEXT value="" name="myText">
      <input type=SUBMIT value="Submit" name="mySubmit">
    </form>
    <br>
    <a href="javascript:submitForm()">Click here to submit the form</a>
    </body>
    </html>








10.26.submit button
10.26.1.Submit
10.26.2.Submit.blur()
10.26.3.Submit.click()
10.26.4.Submit.focus()
10.26.5.Submit.form
10.26.6.Submit.handleEvent()
10.26.7.Submit.name
10.26.8.Submit.onBlur
10.26.9.Submit.onClick
10.26.10.Submit.onFocus
10.26.11.Submit.type
10.26.12.Submit.value
10.26.13.Return false in form button click event
10.26.14.Using Image as the submit button