Export (0) Print
Expand All
all
alt
ch
dir
id
min
rel
top
url
URL
urn
Expand Minimize

coords attribute | coords property

Sets or retrieves the coordinates of the object.

Syntax

HTML<element coords="p" ... >
JavaScript

p = object.coords

 

Property values

Type: String

the coordinates.

Remarks

For a objects, you must set the value of this property before you can retrieve it. This satisfies the requirements of World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1. The document author is responsible for implementing the functionality defined in HTML 4.0 for a objects, if desired.

You must set the value of this property before you can retrieve it.

For area objects, the format of p depends on the value of the shape attribute of the object, as follows:

shape= circ or circlecoords= "x1,y1,r" – Where x1,y2 are the coordinates of the center of the circle, and r is the radius of the circle.
shape= poly or polygoncoords= "x1,y1,x2,y2...xn,yn" – Where each x,y pair contains the coordinates of one vertex of the polygon.
shape= rect or rectanglecoords= "x1,y1,x2,y2" – Where x1,y1 are the coordinates of the upper-left corner of the rectangle and x2,y2 are the coordinates of the lower-right coordinates of the rectangle.

 

In Microsoft Internet Explorer 6 and greater, this property applies to the a object.

Examples

This example provides the full code for an image map of the solar system. Clicking on the sun or any planet links to an individual image.


<p><img src="solarsys.png" width="504" height="126" border="0"
    alt="Solar System" usemap="#SystemMap">

<map name="SystemMap">
    <area shape="rect" coords="0,0,82,126" 
        href="/workshop/graphics/sun.png">
    <area shape="circle" coords="90,58,3" 
        href="/workshop/graphics/merglobe.png">
    <area shape="circle" coords="124,58,8" 
        href="/workshop/graphics/venglobe.png">
    <area shape="circle" coords="162,58,10" 
        href="/workshop/graphics/earglobe.png">
    <area shape="circle" coords="203,58,8" 
        href="/workshop/graphics/marglobe.png">
    <area shape="poly" 
        coords="221,34,238,37,257,32,278,44,284,60,281,75,
	        288,91,267,87,253,89,237,81,229,64,228,54" 
        href="/workshop/graphics/jupglobe.png">
    <area shape="poly" 
        coords="288,19,316,39,330,37,348,47,351,66,349,74,
	        367,105,337,85,324,85,307,77,303,60,307,50" 
        href="/workshop/graphics/satglobe.png">
    <area shape="poly" 
        coords="405,39,408,50,411,57,410,71,404,78,393,80,
	        383,86,381,75,376,69,376,56,380,48,393,44" 
        href="/workshop/graphics/uraglobe.png">
    <area shape="poly" 
        coords="445,38,434,49,431,53,427,62,430,72,435,77,
	        445,92,456,77,463,72,463,62,462,53,455,47" 
        href="/workshop/graphics/nepglobe.png">
    <area shape="circle" coords="479,66,3" 
        href="/workshop/graphics/pluglobe.png">
</map>


See also

area

 

 

Show:
© 2014 Microsoft