<html>
<body>
<h1>The Document Object</h1>
<h2>The open() Method</h2>
<p>If document.write() is used on a closed document, document.open() is automatically called.</p>
<p>This will delete existing content.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
document.write("<h1>Hello World</h1>");
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_doc_write1 by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:39:43 GMT -->
</html>