Gebietskoordinaten Eigenschaft _
Beispiel
Rufen Sie die Koordinaten für einen bestimmten Bereich in einer Bildkarte ab:
var x = document.getElementById("venus").coords;
Definition und Verwendung
Die coords-Eigenschaft legt den Wert des coords-Attributs einer Fläche fest oder gibt ihn zurück.
Das Attribut coords gibt die x- und y-Koordinaten eines Bereichs an.
Das coords-Attribut wird zusammen mit dem shape-Attribut verwendet, um die Größe, Form und Platzierung eines Bereichs anzugeben.
Tipp: Die Koordinaten der oberen linken Ecke einer Fläche sind 0,0.
Tipp: Verwenden Sie die Shape -Eigenschaft, um den Wert des Shape-Attributs eines Bereichs festzulegen oder zurückzugeben.
Browser-Unterstützung
Property | |||||
---|---|---|---|---|---|
coords | Yes | Yes | Yes | Yes | Yes |
Syntax
Geben Sie die coords-Eigenschaft zurück:
areaObject.coords
Legen Sie die coords-Eigenschaft fest:
areaObject.coords = value
Eigenschaftswerte
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
Rückgabewert: | Ein String, der eine durch Kommas getrennte Liste von Koordinaten darstellt |
---|
Mehr Beispiele
Beispiel
Ändern Sie die Koordinaten für einen bestimmten Bereich in einer Bildkarte:
document.getElementById("venus").coords = "90, 58, 3";
Verwandte Seiten
HTML-Referenz: HTML-Attribut <area> coords
❮ Flächenobjekt