host

收藏:0   阅读:26

Area host 属性


定义和用法

host 属性克设置或者返回 href 属性值的 主机名:端口 部分。

语法

areaObject.host=hostname:port


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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


提示和注释

注意: 如果在URL中端口部分没有指定,或者端口为80(默认值),一些浏览器将不会显示端口部分。


实例

下面的例子可返回 "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:port for the "Venus" area is:
<script>
document.write(document.getElementById(‘venus‘).host);
</script>
</p>

</body>
</html>

以上实例输出结果:

The hostname:port for the "Venus" area is: www.bubuko.com:80

© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!