[an error occurred while processing this directive]
javascript tutorial graphic


Webteacher Software now offers

//Create new Window

options = "toolbar=0,status=0,menubar=0,scrollbars=0," +
"resizable=0,width=300,height=200";
newwindow=window.open("","mywindow", options);
newwindow.document.writeln(LocalTime);
newwindow.document.write(contents);
newwindow.document.close();


The Window.open() method

The second parameter is the default title of the window. The third parameter allows you to set a long list of options about your new window. Here are the options you can set.

Optionchoicedescription
toolbar yes/no or 1/0 Display toolbar
status yes/no or 1/0 Display status bar at bottom of window
menubar yes/no or 1/0 Display menubar
scrollbars yes/no or 1/0 Display horizontal and vertical scrollbars
resizable yes/no or 1/0 Window can be resized
location yes/no or 1/0 Display location box
directories yes/no or 1/0 Display directory buttons
width # of pixels Exact width of new window
height # of pixels Exact height of new window

If I want to open the mytest document in a small, 100 x 100 pixel window I would type this:

NewWindow = window.open("mytest.htm","mywindow","width=100,height=100")

As you can see, the window.open() command can get very long. One solution is to specify the options in a seperate variable, which I call "options." Then your command would look like this:

options = "width=100,height=100"
NewWindow = window.open("mytest.htm","mywindow",options)

More about Windows

Home | WebData - Web Database Software | Javascript | CGI | Consulting | Map Builder | Contact Us | The Press Room