Use of the document.open of method in javascript

  • 2020-03-26 21:21:29
  • OfStack

The document.open() method opens a new document, writes its contents in the document.write() method, and then closes the document with the document.close() method to make its contents appear.

Such as:
 
<script type="text/javascript"> 
window.onload=hello; 
function hello(){ 
var msg = "JavaScript This is fun! "; 
document.open(); 
document.write(msg); 
document.close(); 
} 
</script> 

Related articles: