Get the coordinates for a specific area in an image-map:
The result of x will be:
The coords property sets or returns the value of the coords attribute of an area.
The coords attribute specifies the x and y coordinates of an area.
The coords attribute is used together with the shape attribute to specify the size, shape, and placement of an area.
Tip: The coordinates of the top-left corner of an area are 0,0.
Tip: Use the shape property to set or return the value of the shape attribute of an area.
The coords property is supported in all major browsers.
Return the coords property:
Set the coords property:
Value | Description |
---|---|
x1,y1,x2,y2 | If the shape attribute is set to "rect", it specifies the coordinates of the top-left corner and the bottom-right corner of the rectangle |
x,y,radius | If the shape attribute is set to "circle", it specifies the coordinates of the circle center and the radius |
x1,y1,x2,y2,..,xn,yn | If the shape attribute is set to "poly", it specifies the coordinates of the edges of the polygon. If the first and last coordinate pairs are not the same, the browser must add the last coordinate pair to close the polygon |
Return Value: | A String, representing a comma-separated list of coordinates |
---|
Change the coordinates for a specific area in an image-map:
HTML reference: HTML <area> coords attribute