JavaScript Reference/Javascript Collections/forms

Материал из Web эксперт
Версия от 08:22, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"forms" Example

    
<html>
<body>
<form name="form1" method="post" action=""><textarea></textarea></form>
<form name="form2" method="post" action=""><p><input type="text"></p></form>
<form name="form3" method="post" action=""><input type="radio">
<input type="checkbox"></form>
<button onclick="alert(document.forms.length);">Number of forms in the page</button>
</body>
</html>



"forms" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |document                                                      |
+----------------+--------------------------------------------------------------+



"forms" JavaScript properties and JavaScript methods

JavaScript properties and JavaScript methods
 
item(), length, namedItem(), tags(), urns()



"forms" Syntax Parameters and Note

Note:
Returns an array of all <form> elements in the document.
    
Syntax:
    
document.forms // returns all forms
document.forms(param1, param2) // returns an individual form

    param1   Required; zero-based index or 
                       the desired member"s id or name attribute.
                       
    param2   Optional; zero-based index     
                       if param1 matches more than one element.