atributo href HTML DOM ancla
Definición y Uso
conjuntos de propiedades href o devuelve el valor del atributo href enlace.
atributo href especifica la URL es recursos vinculados.
gramática
Establecer el atributo href:
anchorObject.href="URL"
Volver atributo href:
anchorObject.href
值 | 描述 |
---|---|
URL | 被链资源的 URL |
Soporte para el navegador
Todos los principales navegadores soportan atributo href
Ejemplos
Ejemplos
Valor de retorno vincular atributo href:
<html>
<body>
<p><a id="w3s" href="http://www.w3cschool.cc/">W3Schools.com</a></p>
<script>
document.write(document.getElementById("w3s").href);
</script>
</body>
</html>
<body>
<p><a id="w3s" href="http://www.w3cschool.cc/">W3Schools.com</a></p>
<script>
document.write(document.getElementById("w3s").href);
</script>
</body>
</html>
Los ejemplos de la salida anterior:
http://www.w3cschool.cc/
Trate »
objetos de anclaje