Latest web development tutorials

HTML DOM Area host property

Area Object Reference Area objects

Definition and Usage

host property sets or returns grams href attribute value hostname: port section.

grammar

areaObject.host=hostname:port


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support host properties


Tips and Notes

Note: If the port has not been specified in the URL, or port 80 (default value), some browsers will not display the port section.


Examples

Examples

The following example returns the host name and port "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>金星区域的 hostname:port:
<script>
document.write(document.getElementById('venus').host);
</script>
</p>
<p><b>注意:</b>如果没有指定端口部分的URL,或者是80(默认),一些浏览器将不会显示端口的部分。</p>

</body>
</html>

Examples of the above output:

金星区域的 hostname:port: www.w3big.com

try it"


Area Object Reference Area objects