显示文档中的链接数
- <html>
- <body>
- <img src="/i/eg_planets.jpg" border="0" usemap="#planetmap" alt="Planets" />
- <map name="planetmap" id="planetmap">
- <area shape="circle"
- coords="180,139,14"
- href ="/example/html/venus.html"
- target ="_blank"
- alt="Venus" />
- <area shape="circle"
- coords="129,161,10"
- href ="/example/html/mercur.html"
- target ="_blank"
- alt="Mercury" />
- </map>
- <br />
- 文档中链接数目是:
- <script type="text/javascript">
- document.write(document.links.length)
- </script>
- </body>
- </html>