显示文档中的链接数

  1. <html>
  2. <body>
  3.  
  4. <img src="/i/eg_planets.jpg" border="0" usemap="#planetmap" alt="Planets" />
  5.  
  6. <map name="planetmap" id="planetmap">
  7.  
  8. <area shape="circle"
  9. coords="180,139,14"
  10. href ="/example/html/venus.html"
  11. target ="_blank"
  12. alt="Venus" />
  13.  
  14. <area shape="circle"
  15. coords="129,161,10"
  16. href ="/example/html/mercur.html"
  17. target ="_blank"
  18. alt="Mercury" />
  19.  
  20. </map>
  21. <br />
  22.  
  23. 文档中链接数目是:
  24. <script type="text/javascript">
  25. document.write(document.links.length)
  26. </script>
  27.  
  28. </body>
  29. </html>