Image

書式

画像オブジェクト = new Image
画像オブジェクト = new Image()

説明

画像(イメージ)オブジェクトです。画像に関する情報を保持します。HTMLのimgタグで画面に表示されたものは画像オブジェクトとして扱うことができます。

サンプルコード [実行]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<script type="text/javascript"><!--
window.onload = function() {
var imgObj = new Image();
var txt = "";
for (i in imgObj) {
txt += i+" = "+imgObj[i]+"<br>";
}
document.getElementById("result").innerHTML = txt;
}
// --></script>
</head>
<body>
<div id="result"></div>
</body>
</html>