Submit : submit button « Form « JavaScript Tutorial






Instances are created by the browser when it encounters an HTML tag with the TYPE attribute set to SUBMIT.

In the JavaScript object hierarchy, the Submit object is located at window.document.Form.Submit.

Event Handlers/Methods/PropertiesDescription
onBlurCalled when the submit button loses focus.
onClickCalled when the submit button is clicked.
onFocusCalled when the submit button receives the focus.
blur()Removes focus from the submit button.
click()Simulates a mouse click on the submit button.
focus()Gives the focus to the submit button.
handleEvent()Invokes the handler for the event specified and was added in JavaScript 1.2.
formReturns the entire form the submit button is in.
nameReturns the name of the submit button specified by the NAME attribute.
typeReturns the type of this submit button specified by the TYPE attribute. This property always returns submit.
valueReturns the value of this submit button specified by the VALUE attribute.


<html>
    <head>
    <script language="JavaScript">
    <!--
    function openWin(){
      var myInstance = document.myForm.mySubmit;
      var myWin = open("", "","width=450,height=200");

      myWin.document.write("The name is: " + myInstance.name + "<br>");
      myWin.document.write("The type is: " + myInstance.type + "<br>");
  
      myWin.document.write(myInstance.form.mySubmit.value);
      myWin.document.close();
    }
    -->
    </script>
    </head>
    <body>
    <form name="myForm">
      <input type=TEXT value="Hello, World!" name="myText">
    <input type=SUBMIT value="Click to Submit" name="mySubmit"
             onClick="openWin()">
    </form>
    </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