<html>
<head>
</head>
<body>
<script type="text/javascript">
document.write(
"该消息在页面加载时输出。")
</script>
</body>
</html>

当页面被调用时执行,如:
<html>
<head>
<script type="text/javascript">
function message()
{
alert(
"该提示框是通过 onload 事件调用的。")
}
</script>
</head>
<body onload="message()">
</body>
</html>

相关文章: