length
ページ上のリンク総数を返します。
構文
document.links.length
例文
<html> <head> <title>length</title> <script type="text/javascript"><!-- window.onload = function () { var n = document.links.length; document.getElementById("result").innerHTML = n; } // --></script> </head> <body> <ul> <li><a href="http://www.openspc2.org/">OpenSpace</a> <li><a href="http://www.google.co.jp/">Google</a> </ul> <div id="result"></div> </body> </html>
関連記事
スポンサーリンク