JavaScript Reference/Javascript Properties/method

Материал из Web эксперт
Перейти к: навигация, поиск

"method" Example

    
<html>
<body>
<script language=javascript>
    function function1() {
        document.getElementById("myForm").method = "post";
    }
</script>
<form name="myForm" method="get" action="">
<textarea rows="3" cols="200">
</textarea>
</form>
<input type="button" 
       value="Change the mode of transferring the data to "post"" 
       onclick="function1();">
</body>
</html>



"method" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<form>                                                        |
+----------------+--------------------------------------------------------------+



"method" Possible Values

Possible Values
get            appends the data to the URL; 
               the maximum amount of data is 2,084 bytes, 
post           sends the data through an HTTP post transaction; 
               no limit on the amount of data.



"method" Syntax and Note

Note:
Read and write property. 
Sets the mode of transferring <form> data to the server. 
    
Syntax:
    
document.getElementById("formID").method = value
document.all.formID.method = value // IE only