JavaScript Reference/Javascript Methods/namedItem
"namedItem()" Example
<source lang="javascript">
<html> <body> <script language="JavaScript"> function function1() {
document.all.namedItem("myDiv1").innerText = "Named Item";
} </script>
Click button to change me
<button onclick="function1();">Named item</button> </body> </html>
</source>
"namedItem()" is applied to
<source lang="javascript">
Names noted with an asterisk (*) are JavaScript properties only. +----------------+--------------------------------------------------------------+ | Applied_To |all* anchors* | | |applets* areas* | | |boundElements* cells* | | |elements* embeds* | | |filters* <form> | | |forms* frames* | | |images* imports* | | |links* options* | | |plugins* rows* | | |<select> scripts* | | |styleSheets* tBodies* | +----------------+--------------------------------------------------------------+
</source>
"namedItem()" Syntax, Parameters and Note
<source lang="javascript">
Note: Returns the named element from the collection or the named item from a <form> or <select> element.
Syntax:
collectionName.namedItem(param1) document.getElementById("elementID").namedItem(param1) document.all.elementID.namedItem(param1) // IE only Parameters:
param1 Required; the name or id of the element. </source>