Properti hostname Area
Definisi dan penggunaan
hostname
Pengaturan dan pengembalian Nilai properti href bagian nama hostnya.
href
Atur tujuan tautan di dalam area.
Lihat juga:
Panduan JavaScript:Properti location.hostname
Contoh
Contoh 1
Kembalikan nama host kawasan yang ditentukan dalam peta gambar:
var x = document.getElementById("venus").hostname;
Contoh 2
Ubah nama host kawasan yang ditentukan dalam peta gambar:
document.getElementById("venus").host = "www.example.com";
Sintaks
Kembalikan properti hostname:
areaObject.hostname
Tetapkan properti hostname:
areaObject.hostname = hostname
Attribute Value
Value | Description |
---|---|
hostname | Specifies the hostname of the URL. |
Technical Details
Return value: | String value, representing the domain name (or IP address) of the URL. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |