onLoad

書式

<タグ onLoad = "イベント発生時の処理">
オブジェクト.onload = "イベント発生時の処理"

説明

ページや画像などデータの読み込みが完了した時に発生します。

サンプルコード [実行]

<!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() {
document.getElementById("result").innerHTML = "Load";
}
// --></script>
</head>
<body>
<div id="result"></div>
<img src="photo.jpg" width="300" height="196">
</body>
</html>