Home » ★JavaScriptリファレンス

★JavaScriptリファレンス

document.links.length …… ドキュメント内にあるリンクの数を参照する
Internet Explorer
Google Chrome
Safari
Firefox
Opera
広告



linkオブジェクトのhashプロパティは、ドキュメント内にあるリンクの数を参照します。

■構文・引数・戻り値

構文
document.links.length
戻り値
ドキュメント内にあるリンクの数

■使用例

HTML + JavaScriptソース

<script>
var kazu = document.links.length;
document.write('このページ内には');
document.write(kazu);
document.write('個のリンクがあります。');
</script>

↓↓↓

ブラウザ上の表示

■関連項目

document.links.length …… ドキュメント内にあるリンクの数を参照する
document.link.href …… リンク先URLを参照する
document.link.target …… リンクのターゲット属性を参照する
document.link.protocol …… リンク先URLのプロトコルを参照する
document.link.hostname …… リンク先URLのホスト名を参照する
document.link.host …… リンク先URLのホスト情報を参照する
document.link.port …… リンク先URLのポート番号を参照する
document.link.pathname …… リンク先URLのパス名を参照する
document.link.search …… リンク先URLのサーチ情報を参照する
document.link.hash …… リンク先URLのハッシュ部分を参照する
広告



Lorem Ipsum is simply dummy text

    By signing up, you agree to our Terms and Privacy Policy. Unsubscribe anytime.