JavaScript Reference/Javascript Methods/item
"item()" Example
<source lang="javascript">
<html> <body> <input type="button" id="button" value="See the value of this button" onclick="alert(document.all.item("button").value);"> </body> </html>
</source>
"item()" is applied to
<source lang="javascript">
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* | +----------------+--------------------------------------------------------------+
</source>
"item()" Syntax, Parameters and Note
<source lang="javascript">
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. </source>