JavaScript Reference/Javascript Properties/form

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

"form" Example

   <source lang="javascript">
   

<html> <body> <script language="JavaScript"> function function1(form) {

   var elem = document.getElementById("myfunction1").form.id;
   alert(elem);
   return true; 

} </script> <form id="myF"> <input id="myfunction1"

      type="button" 
      value="Get ID of this control"s form" onClick="function1(this.form);">

</form> </body> </html>


     </source>
   
  


"form" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<button> <fieldset> (IE6) | | |<input type="button"> <input type="checkbox"> | | |<input type="file"> <input type="hidden"> | | |<input type="image"> <input type="password"> | | |<input type="radio"> <input type="reset"> | | |<input type="submit"> <input type="text"> | | |<isindex> <label> | | |<legend> <object> | | |<option> <select> | | |<textarea> | +----------------+--------------------------------------------------------------+

     </source>
   
  


"form" Syntax and Note

   <source lang="javascript">

Note: Read-only property. Returns a reference to the <form> element.

Value: An object null (if the container element is not a <form>).

Syntax:

document.getElementById("elementID").form document.all.elementID.form // IE only


     </source>