Coords de área Propiedad
Ejemplo
Obtenga las coordenadas de un área específica en un mapa de imágenes:
var x = document.getElementById("venus").coords;
Definición y uso
La propiedad coords establece o devuelve el valor del atributo coords de un área.
El atributo coords especifica las coordenadas x e y de un área.
El atributo de coordenadas se usa junto con el atributo de forma para especificar el tamaño, la forma y la ubicación de un área.
Consejo: Las coordenadas de la esquina superior izquierda de un área son 0,0.
Sugerencia: use la propiedad de forma para establecer o devolver el valor del atributo de forma de un área.
Compatibilidad con navegador
Property | |||||
---|---|---|---|---|---|
coords | Yes | Yes | Yes | Yes | Yes |
Sintaxis
Devuelve la propiedad coords:
areaObject.coords
Establezca la propiedad coords:
areaObject.coords = value
Valores de propiedad
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 |
Detalles técnicos
Valor de retorno: | Una cadena, que representa una lista de coordenadas separadas por comas |
---|
Más ejemplos
Ejemplo
Cambie las coordenadas de un área específica en un mapa de imagen:
document.getElementById("venus").coords = "90, 58, 3";
páginas relacionadas
Referencia de HTML: HTML <area> coords atributo
❮ Objeto de área