Form.method : Form Object « Form « JavaScript Tutorial






The method property of the Form object represents the type of submission, GET or POST, being used by the form.

<html>
    <head>
    <title> Using the method property of the Form object</title>
    </head>
    <body>
    <script language="JavaScript">
    <!--
    function informMethod(){
        alert("The form method is:" + document.form1.method);
    }
    -->
    </script>
    <form name="form1" method="get">
    First Name:<input type=text" name="first" size=15>
    Last Name:<input type=text" name="last" size=25>
    <br>
    City:<input type=text" name="city" size=20>
    State:<input type=text" name="state" size=2 maxlength=2>
    Zip:<input type=text" name="zip" size=5 maxlength=5>
    <br><br>
    Click the button to see what type of Method is used for submission.
    <input type="button" value="Click Here" onClick='informMethod()'>
    </form>
    </body>
    </html>








10.2.Form Object
10.2.1.Form
10.2.2.Using the Forms Array
10.2.3.Form.action
10.2.4.Form.elements
10.2.5.Form.elements.length
10.2.6.form.encoding
10.2.7.Form.handleEvent()
10.2.8.Form.length
10.2.9.Form.method
10.2.10.Form.name
10.2.11.Form.onReset
10.2.12.Form.onSubmit
10.2.13.Form.reset()
10.2.14.Form.submit()
10.2.15.Form.target