HTML DOM Area hostname property
Definition and Usage
hostname property sets or returns the href attribute worth hostname portion.
grammar
areaObject.hostname=hostname
Browser Support
All major browsers support hostname property
Examples
Examples
The following example returns the host name image map "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>
Examples of the above output:
Venus 区域的主机名称: www.w3big.com
try it"
Area objects