<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function ShowMessage() {
document.write("You are using JavaScript!");
}
</script>
</head>
<body onload="ShowMessage()">
<h1>
A first JavaScript example</h1>
</body>
</html>
结果:标签<h1>A first JavaScript example</h1>里的内容不见了
原因:ShowMessage函数在页面主题载入后才调用,此时浏览器认为文档(document)已经关闭,所以IE浏览器会将文档重新打开,原来的文本即<h1>A first JavaScript example</h1>被清除了,此时只能看到ShowMessage显示的You are using JavaScript!消息了
注:在360安全浏览器上也是同样效果