areas collection
The elements in the collection are sorted in source code order.
Syntax:
Properties that reference the object:
| map.areas |
The base interface, through which you can add new functionalities to the areas collection, is the HTMLCollection interface.
Possible members:
Properties:
Returns an integer that specifies the number of elements in the current collection.
This property is read-only. |
Methods:
[nameOrIndex] |
Returns an element or a collection of elements from the current collection by name or index.
Parameters:
Return value:
|
||||||||||||||||||||||
add (element [, index]) |
Inserts an area element into the current collection at the specified position.
Parameters:
Return value:
This method has no return value.
|
||||||||||||||||||||||
item (nameOrIndex [, subIndex]) |
Returns an element or a collection of elements from the current collection by name or index.
Parameters:
Return value:
|
||||||||||||||||||||||
namedItem (name) |
Returns an element or a collection of elements from the current collection by name.
Parameters:
Return value:
|
||||||||||||||||||||||
remove (index) |
Removes the area element at the specified position from the current collection.
Parameters:
Return value:
This method has no return value.
|
||||||||||||||||||||||
tags | Returns a NodeList collection that contains all elements from the current collection with the specified tag name. | ||||||||||||||||||||||
urns | Returns a NodeList collection that contains all elements to which the specified behavior is attached. |
Example HTML code 1:
This example illustrates the use of the areas collection:
|
||||
<head> <script type="text/javascript"> function GetAreas () { var map = document.getElementById ("myMap"); var message = ""; for (i = 0; i < map.areas.length; i++) { message += i + ". area shape: " + map.areas.item (i).shape + "\n"; } alert (message); } </script> </head> <body> <img src="area.gif" width=504 height=126 border=0 alt="Solar System" usemap="#SampleMap"> <map name="SampleMap" id="myMap"> <area shape="rect" coords="1,-1,83,125" alt="rectangle" href="#"> <area shape="circle" coords="234,57,30" alt="circle" href="#"> <area shape="poly" coords="363,37,380,40,399,35,420,47,426,63,423,78,430,94,409,90,395,92,379,84,371,67,370,57" alt="polygon" href="#"> </map> <button onclick="GetAreas ();">Get areas!</button> </body> |
||||
|
||||
Did you find this example helpful?
|
External links:
User Contributed Comments