lengthプロパティ
anchorオブジェクトのlengthプロパティはアンカー数を返します。
書式 | document.anchors.length | |
---|---|---|
ブラウザ | ||
値 | アンカー数 |
使用例 | 現在のページのアンカー数を表示する。 |
---|
<html>
<head>
<title>JavaScript anchor length</title>
<script type="text/javascript">
function dispAnchorNum(){
alert("アンカー数:" + document.anchors.length);
}
</script>
</head>
<body>
<a name="#anchor1">アンカー1</a><br>
<a name="#anchor2">アンカー2</a><br>
<a name="#anchor3">アンカー3</a><br>
<form name="fm">
アンカー数を表示<br>
<input type="button" value="確認" onClick="dispAnchorNum()">
</form>
</body>
</html>
関連メンバ | 値 |
---|---|
name | アンカー名 |