Document. open () opens a new blank document. In IE, open has two default parameters, which are equivalent to document. open ("text/html", '""). The second parameter has only one optional value: replace. If this value is enabled, the newly created document will overwrite the document on the current page (equivalent to clearing all elements in the original document, and the browser's back button is unavailable );
Let's look at an example: <Input type = "button" value = "first button" onclick = "test ()">
[Ctrl + A select all Note: If you need to introduce external JS, You need to refresh it to execute]
Generally, document. open () and document. Close () are not written, because the browser will open a document before writing, and then output the write content to the original document. After the write operation is complete, no close is performed by default. Otherwise, the previous write will be overwritten in the second line of document. Write.