Koordinat area Properti
Contoh
Dapatkan koordinat untuk area tertentu dalam peta gambar:
var x = document.getElementById("venus").coords;
Definisi dan Penggunaan
Properti coords menetapkan atau mengembalikan nilai atribut coords dari suatu area.
Atribut coords menentukan koordinat x dan y dari suatu area.
Atribut coords digunakan bersama dengan atribut shape untuk menentukan ukuran, bentuk, dan penempatan suatu area.
Tip: Koordinat sudut kiri atas suatu area adalah 0,0.
Tips: Gunakan properti bentuk untuk mengatur atau mengembalikan nilai atribut bentuk dari suatu area.
Dukungan Peramban
Property | |||||
---|---|---|---|---|---|
coords | Yes | Yes | Yes | Yes | Yes |
Sintaksis
Kembalikan properti coords:
areaObject.coords
Setel properti coords:
areaObject.coords = value
Nilai properti
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 |
Detail Teknis
Nilai Kembali: | Sebuah String, mewakili daftar koordinat yang dipisahkan koma |
---|
Lebih Banyak Contoh
Contoh
Ubah koordinat untuk area tertentu dalam peta gambar:
document.getElementById("venus").coords = "90, 58, 3";
Halaman Terkait
Referensi HTML: HTML <area> atribut coords
Objek Daerah