Form : Form Object : Form JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Form » Form Object »

 

Form












The Form object represents an HTML property created by the


tag.

The Form object can be used to access all the properties of the specified form.

Forms can be referenced by either the forms array or directly by name.

Form methods and properties.



























































Property/Method Description
action HTML ACTION attribute of Form object
elements Array reflecting elements within form
elements.length Length of elements array
encoding HTML ENCTYPE attribute of Form object
handleEvent() Handles specific event
length Number of elements within form
method HTML METHOD attribute of Form object
name HTML NAME attribute of Form object
onReset Event handler for Reset button
onSubmit Event handler for Submit button
reset() Resets form elements
submit() Submit for data
target HTML TARGET attribute of Form object















<html>
    <head>
    <title> Using the name property to access a form object</title>
    </head>
    <body>
    <script language = "JavaScript">
    <!--
    function checkName(){
         var firstName = document.formEx.first.value;
         var lastName = document.formEx.last.value;
         alert("The name you entered is: " + firstName + " " + lastName);
    }
    -->
    </script>
    <form name="formEx">
    First Name:
    <input type="text" name="first" size="20">
    Last Name:
    <input type="text" name="last" size="25">
    <br><br>
    Click the button to check that the information is correct.
    <br>
    <input type="button" value="verify" name="check" onClick='checkName()'>
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Form
» Form Object