Attributo hostname dell'area
Definizione e uso
hostname
Imposta o restituisce l'attributo Valore dell'attributo href la parte del nome host.
href
Definisce l'obiettivo del link nell'area specifica.
Vedi anche:
Manuale di riferimento JavaScript:Attributo location.hostname
Esempio
Esempio 1
Restituisce il nome host dell'URL dell'area specifica nella mappa delle immagini:
var x = document.getElementById("venus").hostname;
Esempio 2
Modifica il nome host dell'area specifica nella mappa delle immagini:
document.getElementById("venus").host = "www.example.com";
Sintassi
Restituisce l'attributo hostname:
areaObject.hostname
Imposta l'attributo hostname:
areaObject.hostname = hostname
Valore dell'attributo
Valore | Descrizione |
---|---|
hostname | Stabilisce il nome dell'host dell'URL. |
Dettagli tecnici
Valore di ritorno: | Valore di stringa che rappresenta il dominio dell'URL (o l'indirizzo IP). |
---|
Supporto browser
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Supporto | Supporto | Supporto | Supporto | Supporto |