Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> JavaScript >> Snippet

Create content in a new window


Once a window is created, and you know the name of it, you can create content by simply using
multiple calls of the .write() method.

For example, if you created a new Window named myWindow, then to create content using
JavaScript use this code :

myWindow.document.open() 
myWindow.document.write( "<html><body>" >
myWIndow.document.write( "<h2>Hello</h2>" >
myWIndow.document.write( "</body></html>" >
myWIndow.document.close()

You can make the content as complicated as you want, with combinations of HTML tags.