JavaScript Reference/Javascript Properties/method

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

"method" Example

   <source lang="javascript">
   

<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>


     </source>
   
  


"method" is applied to

   <source lang="javascript">

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

     </source>
   
  


"method" Possible Values

   <source lang="javascript">

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.
   
     
     </source>
   
  


"method" Syntax and Note

   <source lang="javascript">

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


     </source>