Submit : submit button : Form JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Form » submit button »

 

Submit









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/Properties Description
onBlur Called when the submit button loses focus.
onClick Called when the submit button is clicked.
onFocus Called 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.
form Returns the entire form the submit button is in.
name Returns the name of the submit button specified by the NAME attribute.
type Returns the type of this submit button specified by the TYPE attribute. This property always returns submit.
value Returns 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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Form
» submit button