JavaScript Reference/Javascript Methods/item — различия между версиями

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

Текущая версия на 08:22, 26 мая 2010

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