Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
namedItem (Areas)

namedItem method

Retrieves an object from an areas collection.

Syntax

var pdisp = areas.namedItem(name);

Parameters

name [in]

Type: String

A String that specifies the IHTMLAnchorElement::name or IHTMLElement::id property of the object to retrieve. A collection is returned if more than one match is made.

pdisp [out, retval]
C++The address of a pointer to a variable that receives an IDispatch interface for the object or collection if successful, or null otherwise.
JavaScriptReturns an object or a collection of objects if successful, or null otherwise.

Return value

Type: Object

The address of a pointer to a variable that receives an IDispatch interface for the object or collection if successful, or null otherwise.Returns an object or a collection of objects if successful, or null otherwise.

Standards information

There are no standards that apply here.

Remarks

This method first searches for an object with a matching IHTMLElement::id attribute. If a match is not found, then the method searches for an object with a matching IHTMLAnchorElement::name attribute, but only on those elements that are allowed a name attribute.

Windows Internet Explorer 8 and later. In IE8 Standards mode, the IHTMLAreasCollection3::namedItem method does not return collections if more than one named item is found; instead, it returns the first case-insensitive matched element. For more information on IE8 mode, see Defining Document Compatibility.

The IHTMLAreasCollection3::namedItem method was introduced in Microsoft Internet Explorer 6

Examples

The following example shows how to use the IHTMLAreasCollection3::namedItem method to retrieve a div and change its IHTMLElement::innerHTML property.


<div id="oDIV1">This text will not change.</div>
<div id="oDIV2">This text will change.</div>
<button onclick="document.all.namedItem('oDIV2').innerHTML='Changed!';">
   Change Option
</button>

See also

areas

 

 

Show:
© 2015 Microsoft