Techcss
Javascript_page_menu

JavaScript Window Object

This is the base plate of browser display and this is the container object according to the Navigator Object hierarchy.

The window object is the parent object of each loaded document.

The properties and methods of the window object are listed in the following table:

Name Description
frames Array of objects containing an entry for each frame in a frameset document
parent The frameset in a frameset-frame relationship
self The current window-used to distinguish between windows and forms of the same name
top Top-most parent window
status Value of text displayed in window's status bar
defaultStatus Dafault value displayed in the status bar
alert() Displays a message in a dialog box with an OK button
confirm() Displays a message in a dialogue box with OK and Cancel button
close() Closes the current window
open() Opens a new window with specified document or opens a document in the named window
prompt() Displays a message in the dialog box along with text entry field
setTimeout() Sets timer for specified number of seconds and evaluates an expression when the timer finish counting
clearTimeout() Cancels a previously set timeout

Windows Properties and Methods

A simple example of status using properties and methods.

<html>
<body>


<script>
document.write("What is computer game?");
document.write("It will keep yourself engaged with Computer and 
utterly block your mind and stress your mind to always win condition");
document.write("<a href='games.html' onMouseOver='self.status='A huge
 collection of games'; 
return true;>Game</a> keeps you enthralled for few hours, keeping you
 obsessed into it.");
</script>

</body>
</html>

The return true is essential after setting a new value to the status bar


The open() and close() methods

The open() method open a new window and provides information regarding open window and its content.

The open method takes three arguments, the first two are copulsory while the third is optional. The format is:
Open("URL", "windowName", "featureList");

The featureList can contain any of the following entries :

Name Description
toolbar Creates the standard toolbar
location Creates the location entry field
directories Creates the standard directory buttons
status Creates the status bar
menubar Creates the menubar at the top of the window
scrollbars Creates scroll bars when document grows beyond window size
resizable Enables window resizing
width Specifies window width in pixels
height Specifies window height in pixels

Example: This example opens a document named "radixsystech.com" in a new window.

<html>
<body>
<script>
window.open("http://radixsystech.com","newWindow","resizable=yes,toolbar=yes,
				menubar=1,width=500,height=400,scrollbars=1,status=yes");
</script>
</body>
</html>