length

種類プロパティ(R)
書式 画像オブジェクト.length
解説
画像の総数(<img>タグの総数)を返します。
サンプルコード
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<style type="text/css"><!--
body { margin:0px; }
form { position:absolute; top:80;left:10px; }
#photo { position:absolute; top:10;left:110px; }
--></style>
<script type="text/javascript"><!--
window.onload = function()
{
n = document.images.length;
document.getElementById("txtField").value = n;
}
// --></script>
</head>
<body>
<img src="Default.png">
<img src="photo.png" id="photo">
<img src="photo.png" id="photo2">
<form>
<input type="text" id="txtField" size="40">
</form>
</body>
</html>
実際のスクリプトをダウンロード