Współrzędne obszaru Nieruchomość
Przykład
Uzyskaj współrzędne określonego obszaru na mapie obrazu:
var x = document.getElementById("venus").coords;
Definicja i użycie
Właściwość coords ustawia lub zwraca wartość atrybutu coords obszaru.
Atrybut coords określa współrzędne x i y obszaru.
Atrybut coords jest używany razem z atrybutem kształtu do określenia rozmiaru, kształtu i położenia obszaru.
Wskazówka: współrzędne lewego górnego rogu obszaru to 0,0.
Porada: Użyj właściwości shape , aby ustawić lub zwrócić wartość atrybutu kształtu obszaru.
Obsługa przeglądarki
Property | |||||
---|---|---|---|---|---|
coords | Yes | Yes | Yes | Yes | Yes |
Składnia
Zwróć właściwość coords:
areaObject.coords
Ustaw właściwość coords:
areaObject.coords = value
Wartości nieruchomości
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 |
Szczegóły techniczne
Wartość zwrotu: | String, reprezentujący listę współrzędnych oddzielonych przecinkami |
---|
Więcej przykładów
Przykład
Zmień współrzędne określonego obszaru na mapie obrazu:
document.getElementById("venus").coords = "90, 58, 3";
Powiązane strony
Odniesienie HTML: HTML <obszar> atrybut coords
❮Obszar obiektu