JavaScript document open() method: open a new document

<html>
<head>
<script type="text/javascript">
function createNewDoc()
{
    var new_doc = document.open("text/html","replace");
    var txt = "<html><body>这是新的文档</body></html>";
    new_doc.write(txt);
    new_doc.close();
}
</ script > 
</ head > 
< body > 
< button onclick ="createNewDoc()" > Click to write new document </ button >

</body>
</html>

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325096494&siteId=291194637