Area pathname 属性
定义和用法
pathname 属性可设置或返回href属性值中的路径名部分。
语法
浏览器支持




所有主要浏览器都支持 pathname 属性
提示和注释
注意:在以下实例中, IE 和 Opera 返回 "jsref/venus.htm",
但是 Firefox, Chrome, 和 Safari 返回 "/jsref/venus.htm".
实例
下面的例子可返回 "Venus" 区域中href属性值中的路径名:
<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>Venus area‘s pathname:
<script>
document.write(document.getElementById(‘venus‘).pathname);
</script>
</p>
</body>
</html>
以上实例输出结果:
Venus area‘s pathname: jsref/venus.htm