hostname properti HTML DOM di Area
Definisi dan Penggunaan
hostname set properti atau mengembalikan atribut href porsi layak hostname.
tatabahasa
areaObject.hostname=hostname
Dukungan Browser
Semua browser utama mendukung properti hostname
contoh
contoh
Contoh berikut mengembalikan nama host gambar peta "Venus" area:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body>
<img src="planets.gif" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
</map>
<p>Venus 区域的主机名称:
<script>
document.write(document.getElementById('venus').hostname);
</script>
</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body>
<img src="planets.gif" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
</map>
<p>Venus 区域的主机名称:
<script>
document.write(document.getElementById('venus').hostname);
</script>
</p>
</body>
</html>
Contoh output di atas:
Venus 区域的主机名称: www.w3big.com
Coba »
benda daerah