Area hrefPropiedad
Objeto Area
Definición y uso
La propiedad href puede establecer o devolver el valor del atributo href de un área.
La propiedad href especifica el enlace de destino de un área.
Sintaxis
areaObject.href=URL
Compatibilidad del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales admiten la propiedad href
Ejemplo
Ejemplo
El siguiente ejemplo devuelve el atributo href del área "Venus" en un mapa de imagen:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial de Ejemplo (example.com)</title>
</head>
<body>
<img src="planets.gif.html" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm.html">
</map>
<p>El valor del atributo href de Venus:
<script>
document.write(document.getElementById("venus").href);
</script>
</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial de Ejemplo (example.com)</title>
</head>
<body>
<img src="planets.gif.html" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm.html">
</map>
<p>El valor del atributo href de Venus:
<script>
document.write(document.getElementById("venus").href);
</script>
</p>
</body>
</html>
El resultado del ejemplo anterior:
El valor del atributo href de Venus: http://www.example.com/try/demo_source/venus.htm
Pruébalo »
Objeto Area Otras extensiones