JavaScript Reference/Javascript Methods/item

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

"item()" Example

    
<html>
<body>
<input type="button" id="button" value="See the value of this button" 
onclick="alert(document.all.item("button").value);">
</body>
</html>



"item()" is applied to

Names noted with an asterisk (*) are JavaScript properties only.
+----------------+--------------------------------------------------------------+
| Applied_To     |all*                            anchors*                      |
|                |applets*                        areas*                        |
|                |attributes*                     behaviorUrns*                 |
|                |blockFormats*                   boundElements*                |
|                |cells*                          childNodes*                   |
|                |children*                       controlRange*                 |
|                |elements*                       embeds*                       |
|                |filters*                        fonts*                        |
|                |<form>                          forms*                        |
|                |frames*                         images*                       |
|                |imports*                        links*                        |
|                |mimeTypes*                      namespaces*                   |
|                |options*                        pages*                        |
|                |plugins*                        rows*                         |
|                |rules*                          scripts*                      |
|                |styleSheets*                    tBodies*                      |
+----------------+--------------------------------------------------------------+



"item()" Syntax, Parameters and Note

Note:
Returns either the item or <input> element.
    
Syntax:
    
collectionName.item(param1, param2)
document.formID.item(param1, param2)
document.all.formID.item(param1, param2) // IE only
Parameters:
    param1   Required; zero-based index or the desired member"s id or name attribute.
    param2   Optional; zero-based index of returned elements for the results returned
                       if param1 matches more than one element.