Area hostname 属性

Area 对象参考手册 Area 对象

定义和用法

hostname 属性可设置或返回 href 属性值得主机名部分。

语法

areaObject.hostname=hostname


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 hostname 属性


实例

实例

下面的例子可返回图像映射中 "Venus" 区域的主机名:

<html>
<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>The hostname for the "Venus" area is:
<script>
document.write(document.getElementById('venus').hostname);
</script>
</p>

</body>
</html>

以上实例输出结果:

The hostname for the "Venus" area is: www.techbrood.com

尝试一下 »


Area 对象参考手册 Area 对象