Regio coördineert Eigendom
Voorbeeld
Verkrijg de coördinaten voor een specifiek gebied in een afbeeldingskaart:
var x = document.getElementById("venus").coords;
Definitie en gebruik
De eigenschap coords bepaalt of retourneert de waarde van het kenmerk coords van een gebied.
Het kenmerk coords specificeert de x- en y-coördinaten van een gebied.
Het attribuut coords wordt samen met het attribuut shape gebruikt om de grootte, vorm en plaatsing van een gebied te specificeren.
Tip: De coördinaten van de linkerbovenhoek van een gebied zijn 0,0.
Tip: Gebruik de shape- eigenschap om de waarde van het shape-attribuut van een gebied in te stellen of te retourneren.
Browserondersteuning
Property | |||||
---|---|---|---|---|---|
coords | Yes | Yes | Yes | Yes | Yes |
Syntaxis
Retourneer de eigenschap coords:
areaObject.coords
Stel de eigenschap coördinaten in:
areaObject.coords = value
Eigendomswaarden
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 |
Technische details
Winstwaarde: | Een tekenreeks, die een door komma's gescheiden lijst van coördinaten vertegenwoordigt |
---|
Meer voorbeelden
Voorbeeld
Verander de coördinaten voor een specifiek gebied in een image-map:
document.getElementById("venus").coords = "90, 58, 3";
Gerelateerde pagina's
HTML-referentie: HTML <area> coords-kenmerk
❮ Gebiedsobject