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

Home
JavaScript Tutorial
1.Language Basics
2.Operators
3.Statement
4.Development
5.Number Data Type
6.String
7.Function
8.Global
9.Math
10.Form
11.Array
12.Date
13.Dialogs
14.Document
15.Event
16.Location
17.Navigator
18.Screen
19.Window
20.History
21.HTML Tags
22.Style
23.DOM Node
24.Drag Drop
25.Object Oriented
26.Regular Expressions
27.XML
28.GUI Components
29.Dojo toolkit
30.jQuery
31.Animation
32.MS JScript
JavaScript Tutorial » Form » submit button 
10.26.3.Submit.click()

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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.