显示文档中首个链接的 href 属性

  1. <html>
  2. <body>
  3.  
  4. <img id="planets"
  5. src="/i/eg_planets.jpg"
  6. usemap="#planetmap" />
  7.  
  8. <map name="planetmap">
  9. <area id="venus" shape="circle"
  10. coords="180,139,14"
  11. href ="/example/html/venus.html"
  12. target ="_blank"
  13. alt="Venus" />
  14. </map>
  15. <br />
  16.  
  17. area 元素的 id 是:
  18. <script type="text/javascript">
  19. document.write(document.links[0].id)
  20. </script>
  21.  
  22. </body>
  23. </html>