<html>
<body>
<h1>Document 对象</h1>
<h2>open() 方法</h2>
<p>打开文档会删除现有内容。</p>
<p>打开此文档并向其中写入一些文本:</p>
<button onclick="myFunction()">试一试</button>
<script>
function myFunction() {
document.open();
document.write("<h1>Hello World</h1>");
document.close();
}
</script>
</body>
</html>