Window is an object that corresponds to the window that displays
a Web page. Such a window can be created dynamically.
It is a de facto standard.
The attributes and methods of the interface
window are recognized
by Internet Explorer 4, Firefox 1, Opera 9, newer versions and Safari. This
document is based on what is supported by the browsers in the absence of
official standard, see . references
The current window is referenced by the keyword
window, and windows
dynamically created by the name given to the object assigned by the return
value of the open method. Defintion and test of attributes and inner objects in
Definitions of attributes and inner objets
can be read only for some, their value can be assigned otherwise.
The frames in the window. Read only.
Number of frames. Read only.
Name of the window.
Text of the status bar
Under Firefox, modification of the text is an option. Go to Options, Content,
the text of the status bar." defaultStatus
Default text in statusbar.
State closed or not.
Reference on the window that opened this window. Example:
x = window.opener;
The window parent of a window. Example:
x = mywin.parent;
The parent of the highest level.
Objects in window
have their own attributes and methods that are not detailed here but they have
their own page.
Refers to a page, that is contained in the window.
. Document history
List of pages previously viewed in the same window.
. History location
Designates the URL of a page that contains the window.
. Location screen
The screen and its properties: width, height, availWidth, availHeight, colorDepth.
See also the properties for window creation in the chapter:
Checking properties of the Windows object in the browser
Properties not supported by a browser are
Some properties are used as parameters of the window's constructor but they are not directly accessible and not listed here.
menubar personalbar statusbar toolbar scrollbars
Do not work with Firefox 7
We can obtain equivalent values in Internet Explorer and with all browsers:
DOCTYPE declaration could have an effect on these values. Methods of
window and demos
The methods to open or close a windows are described in the chapter:
Definitions of methods
Displays a message.
x = prompt(message)
Presents a dialog box requesting a user response and returns the answer.
x = confirm(message)
Displays a message, a question normally, with two buttons to confirm or
true or false. resizeTo(w, h)
Resizes the width and height.
Scrolling must be enabled for the window according to scrollbars flag,
this is the case by default.
Move to the given position.
id = setInterval(expression, milliseconds)
Evalue an expression repeatedly according to the time in interval.
Clear the interval.
id = setTimeout(expression, milliseconde)
Evalue an expression after the deadline.
Clear the delay.
Pass the focus to the window.
Suppress the focus to the current/given window.
Create a sub-window.
Start the printing of the contents of the window.
Demonstration of methods of the HTML
Click on a button to see how a method works. The corresponding code is displayed
example of use
of setTimeout is included in the lightbox with fade in effect demo.
An early specification by the W3C, Window Object, is
abandoned because it is replaced by the
5 specification in work which includes a definition of that object.
© 2008-2012 Xul.fr