HTML DOM coords 属性

定义和用法

coords 属性设置或返回一个逗号分隔列表,其中包含了图像映射中一个链接的坐标。

语法

  1. anchorObject.coords=coordinates

实例

下面的例子可返回图像映射中一个链接的坐标:

  1. <html>
  2. <body>
  3.  
  4. <img src="planets.gif"
  5. width="145" height="126"
  6. usemap="#planetmap" />
  7.  
  8. <map name="planetmap">
  9. <area id="venus" shape="circle"
  10. coords="124,58,8"
  11. alt="Venus"
  12. href="venus.htm" />
  13. </map>
  14.  
  15. <p>Venus coordinates:
  16. <script type="text/javascript">
  17. x=document.getElementById("venus");
  18. document.write(x.coords);
  19. </script>
  20. </p>
  21.  
  22. </body>
  23. </html>