HTML DOM hash 属性
定义和用法
hash 属性可设置或返回一个区域中 URL 的锚部分。
语法
- areaObject.hash=anchorname
实例
下面的例子可把 URL 的锚部分 #top 更改为 #bottom:
- <html>
- <head>
- <script type="text/javascript">
- function changeLink()
- {
document.getElementById('venus').hash="bottom"
- }
- </script>
- </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="venus2.htm#top" />
- </map>
- <input type="button" onclick="changeLink()" value="Change link" />
- </body>
- </html>