Almost,..... You can use open a new window and write text to it, that text would be HTML tags and content.
Window_DOT_open('','_blank');
document_DOT_write("<HTML> Create HTML Using JavaScript")
document_DOT_write("")
to create an HTML document that can be opened in a new window on the fly but by design and for security reasons, regular JavaScript scripts in web pages are not
allowed to write to the local file system.
Or build a variable that is a concatenation of various HTML tags and
content then write that variable to the new window
Window_DOT_open('','_blank');
document_DOT_write("<HTML> Create HTML Using JavaScript")
document_DOT_write("")
to create an HTML document that can be opened in a new window on the fly but by design and for security reasons, regular JavaScript scripts in web pages are not
allowed to write to the local file system.
Or build a variable that is a concatenation of various HTML tags and
content then write that variable to the new window