Area hashPropiedad
Objeto Area
Definición y uso
La propiedad hash puede establecer o devolver la parte del ancla del valor del atributo href.
Sintaxis
areaObject.hash=anchorname
Compatibilidad del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales admiten la propiedad hash.
Ejemplo
Ejemplo
El siguiente ejemplo puede devolver la parte del ancla del atributo href en el área "Venus":
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial para novatos (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 ancla del atributo href de Venus:
<script>
document.write(document.getElementById("venus").hash);
</script>
</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial para novatos (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 ancla del atributo href de Venus:
<script>
document.write(document.getElementById("venus").hash);
</script>
</p>
</body>
</html>
El resultado del ejemplo anterior es:
El ancla del atributo href de Venus: #description
Pruébalo »
Objeto Area Otras extensiones