Page 131 - DCAP202_Fundamentals of Web Programming
P. 131
Fundamentals of Web Programming
Notes menus, status bar, the page itself, and a whole lot more besides. Effectively, the Window is the
browser.
10.1 Window Objects
The window object, which is a top-level object in Client Side JavaScript, represents a window or
a frame (within a frameset). Since window object is a top-level object, it contains other objects
like ‘document’, ‘history’ etc. within it.
Example: Window.document.frames[i], where i is 1,2,3....., refers to the index of the
frame residing in the current window.
For a top-level window, the parent and top properties refer to the window itself. For frame, the
top refers to the topmost browser window, and parent refers to the parent window of the current
window.
If a frame has name and src attribute you can refer to that frame from a sibling frame by using
parent.frameName or parent.frames[i], where i is 1,2,3.......
Did u know? A window object is opened with window.open() and closed with
window.close(), if the window does not refer to a frame.
In the subsequent pages we have discussed window object in detail with lots of examples.
10.1.1 JavaScript Window Objects Property
Name Description Version
Determine whether a window is closed or
closed Implemented in JavaScript 1.1
not.
Retrieves the default message displayed
defaultStatus Implemented in JavaScript 1.0
in the window’s status bar at the bottom.
Contains information about the current
document Implemented in JavaScript 1.0
document.
Specifies the vertical dimension(height of
innerHeight Implemented in JavaScript 1.2
the window), in pixels.
Specifies the horizontal dimension(width
innerWidth Implemented in JavaScript 1.2
of the document)), in pixels.
Specify the information of the current
location Implemented in JavaScript 1.0
URL.
Test whether the location bar is visible is
locationbar Implemented in JavaScript 1.2
or not.
menubar Refers the browser window's menu bar. Implemented in JavaScript 1.2
Get the unique name of a specified
name Implemented in JavaScript 1.0
window.
Specifies the window of the calling
opener Implemented in JavaScript 1.1
document.
Specifies the vertical dimension, in pixels,
Contd....
outerHeight Implemented in JavaScript 1.2
of the window's outside boundary.
Specifies the horizontal dimension of the
outerWidth Implemented in JavaScript 1.2
window’s outside boundary.
124 LOVELY PROFESSIONAL UNIVERSITY
Refers the current x-position of a page in
pageXOffset Implemented in JavaScript 1.2
a window.
Refers the current y-position of a page in
pageYOffset Implemented in JavaScript 1.2
a window.
Refers the browser window's personal
personalbar Implemented in JavaScript 1.2
bar.
Specify the x coordinate of the left edge
screenX Implemented in JavaScript 1.2
of the window.
Refers the y-coordinate of the upper edge
screenY Implemented in JavaScript 1.2
of a window.
Refers the scroll bars of the browser
scrollbars Implemented in JavaScript 1.2
window..
Specifies a string displayed in the
status browser status bar at the bottom of the Implemented in JavaScript 1.0
window.
Refers the status bar of the browser
statusbar Implemented in JavaScript 1.2
window.
Refers the toolbar of the browser
toolbar Implemented in JavaScript 1.2
window.