x
 
<!DOCTYPE html>
<html>
<body>
<h1>Document 对象</h1>
<h2>write() 方法</h2>
<p>点击“打开”可打开一个新窗口。</p>
<button onclick="myFunction()">打开</button>
<script>
function myFunction() {
  const myWindow = window.open();
  myWindow.document.write("<h1>New Window</h1>");
  myWindow.document.write("<p>Hello World!</p>");
}
</script>
</body>
</html>