please dont rip this site
The Areas Collection

Note : The Areas collection is Internet Explorer specific. Netscape includes all <AREA> element objects in the Links collection. For properties, methods and events that are supported by <AREA> element, see the Client Side Image Maps topic.

The Areas collection is an ordered, indexed array, containing a reference to every <AREA> element in a given <MAP> element. A separate Areas collection is available for each different <MAP> element in the document and the Areas collection can only be referenced through a reference to a valid <MAP> element object.

Area Objects would normally be retrieved by their index in the Areas collection. I.e.:

document.<MAP>reference.areas(1).href

returns the HREF attribute of the second <AREA> element in the <MAP> element referenced by <MAP>reference. For example, consider the following:

<MAP NAME="Map1">
<AREA SHAPE="circle" COORDS="52,49,35" HREF="index.htm">
<AREA SHAPE="rect" COORDS="53,34, 131,82" HREF="start.htm">
</MAP>

Calling the following in a script function:

document.all('Map1').areas(1).href

would return start.htm. (Note that the <MAP> element doesn't have to be referenced through the All Collection)

A string value can be used however, as long as that string is a valid identifier (ID attribute value) for an <AREA> element in the referenced <MAP> element in the document.

E.g.

document.<MAP>reference.areas('Area1').title

would return the TITLE attribute of the <AREA> whose NAME, or ID property is 'Area1', in the <MAP> element referenced by <MAP>reference.

Properties

length
The length property returns the number of areas in the collection. Note that the length count starts at 1, not 0 as the areas collection index does. Therefore, the length property may return a value of 5, but to access the 3rd area in a <MAP>, you'd need to use document.<MAP>reference.areas(2).property

Methods

item
The item method retrieves single items, or sub-collections from an areas collection. It accepts the following arguments:

areas.item(index, sub-index)

If index is a number, then the method returns a reference to the <AREA> at that position in the areas collections index. I.e.

strTag=document.<MAP>reference.areas.item(2).title

would make strTag be the value of the TITLE attribute of the <MAP>'s third <AREA>. As you can see, this is effectively the long-hand version of using document.<MAP>reference.areas(2).property.

If the index property is a string value, then the item method returns a sub-collection, containing a reference to every area in the map that has its NAME or ID attribute set to the string contained in the index argument. To retrieve certain element objects from this sub-collection, the sub-index argument must be used.


file: /Techref/language/html/ib/Scripting_Reference/areacol.htm, 4KB, , updated: 2004/3/1 15:47, local time: 2024/11/28 06:32,
TOP NEW HELP FIND: 
18.117.103.185:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/Techref/language/html/ib/Scripting_Reference/areacol.htm"> The Areas collection</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .