Coordinate dell'area Proprietà
Esempio
Ottieni le coordinate per un'area specifica in una mappa immagine:
var x = document.getElementById("venus").coords;
Definizione e utilizzo
La proprietà coords imposta o restituisce il valore dell'attributo coords di un'area.
L'attributo coords specifica le coordinate xey di un'area.
L'attributo coords viene utilizzato insieme all'attributo shape per specificare la dimensione, la forma e il posizionamento di un'area.
Suggerimento: le coordinate dell'angolo superiore sinistro di un'area sono 0,0.
Suggerimento: utilizzare la proprietà shape per impostare o restituire il valore dell'attributo shape di un'area.
Supporto browser
Property | |||||
---|---|---|---|---|---|
coords | Yes | Yes | Yes | Yes | Yes |
Sintassi
Restituisce la proprietà coordinate:
areaObject.coords
Imposta la proprietà delle coordinate:
areaObject.coords = value
Valori di proprietà
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 |
Dettagli tecnici
Valore di ritorno: | Una stringa, che rappresenta un elenco di coordinate separate da virgole |
---|
Altri esempi
Esempio
Modifica le coordinate per un'area specifica in una mappa immagine:
document.getElementById("venus").coords = "90, 58, 3";
Pagine correlate
Riferimento HTML: attributo HTML <area> coordinate
❮ Oggetto Area