Link href-eigenschap
Definitie en gebruik
href
Instellen of teruggeven van de URL van het gelinkte document.
Zie ook:
HTML Referentiemanual:HTML <link> href attribute
HTML Referentiemanual:HTML <link> tag
Voorbeeld
Voorbeeld 1
Geef de URL van het gelinkte document terug:
var x = document.getElementById("myLink").href;
Voorbeeld 2
Wijzig de stylesheet:
document.getElementById("myLink").href = "style2.css";
Syntax
Geef de href-eigenschap terug:
linkObject.href
Stel de href-eigenschap in:
linkObject.href = URL
Eigenschapswaarde
Waarde | Beschrijving |
---|---|
URL |
Stelt de URL van het gelinkte resource/document vast. Mogelijke waarden:
|
Technical details
Return value: | A string value that represents the URL of the linked document. Returns the entire URL, including the protocol (such as http://). |
---|
Browser support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |