Window Object

By: aathishankaran Emailed: 1769 times Printed: 2515 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

Creating, a window 

To create a window use the following syntax: 

            Window_object_name=]open(“url","Window name"[,"attribute"]) 

The URL parameter specifies what content appears in the new window. If you specify a value, the browser attempts to locate and display the specified document: 

        newWindow=“", "Home Page","") 

Alternatively, you can display a blank page by specifying an empty string ("") as the URL parameter. Use this technique if you want to create an HTML page dynamically using JavaScript: 

newWindow =“", “DynamicPage", “")

newWindow.document.write(“<Hl>Document created using JavaScript.</Hl>") newWindow.document.close () 

Specifying Window Attributes 

The windowAttributes parameter is important as you display windows because it

Lets you customize the look of the window you are opening. The window Attributes parameter is optional; not including it gives you a window identical to the current one with respect to attributes. 




Width of window in pixels


Height of window in pixels


Show/hide browser toolbar


Show/hide browser menu bar


Show/hide browser horizontal and vertical scrollbars


Allow/disallow resizing of browser window


Show/hide browser status bar


Show/hide URL location box


Show/hide secondary toolbar (Netscape)


Copy current window's Go history for new window

             The width and height attributes specify the dimensions of the window in pixels.

The remaining attributes are set by using Boolean values: True values are either 1, yes, or the attribute alone; false values are either 0, no, or more simply, leaving it out altogether. For example, if you want to display the new window with only a toolbar and menu bar, you use the following line: 

newWindow ="”,"my Window”, "toolbar=l,   menubar=l”) 

The following syntaxes are also valid: 

newWindow = window. open ("", "myWindow” , "toolbar=yes , menubar=yes”)

newWindow = window. open (" “, "myWindow “ , "toolbar, menubar”) 

As you can see, you can simply leave out those attributes that are not specified. They are assumed to have false values. 





Example For Window Object



<Hl>Example for Window Object</Hl>



<Form Name=form1>


<Input Type=Button


Value=”Open java”



<Input Type=Button



onClick=”‘’,’’,'toolbar=0, menubar=0, status=0')

win.document.write ('<H1>Help For The page</H1>' );

win.document.write('<ol>') ;

win.document.write ('<li>Click on the Open Hotmail' );

win. doo.nnent. write ( '<li>The Hotmail web page is loaded') ;

win.document.write('<li>If Hotmail is not loaded then, You may not have connected to Internet');








Java Home | All Java Tutorials | Latest Java Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.

Bookmark and Share


Be the first one to add a comment

Your name (required):

Your email(required, will not be shown to the public):

Your sites URL (optional):

Your comments:

More Tutorials by aathishankaran
Web Security Issues
The Web User's Perspective
Server-side plug-Ins
The best way to avoid security vulnerabilities with new server
JavaScript Security
Window Object
Working with Status Bar Messages
Retrieving a Portion of a String
Referencing Windows
Math Object
Frame Object
Document Object
Closing Windows
Built-in Object in Javascript
Textarea Object

More Tutorials in Java
Update contents of a file within a jar file
Tomcat and httpd configured in port 8080 and 80
Java File
Java String
Count number of vowels, consonants and digits in a String in Java
Reverse a number in Java
Student marks calculation program in Java
Handling Fractions in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
MultiLevel Inheritance sample in Java
Multiple Inheritance sample in Java
Java program using Method Overriding
Java program to check if user input is an even number

More Latest News
Most Viewed Articles (in Java )
How to use ArrayList in Java
InetAddress Example program in Java
Method Overloading (function overloading) in Java
FileReader and FileWriter example program in Java
Simple Port Scanner application using Java
Student marks calculation program in Java
Calculate gross salary in Java
Read from a COM port using Java program
delete() and deleteCharAt() in Java
append() in Java
indexOf( ) and lastIndexOf( ) in Java
XML and Java - Parsing XML using Java Tutorial
Vector in Java - Sample Program
How to Send SMS using Java Program (full code sample included)
Count number of vowels, consonants and digits in a String in Java
Most Emailed Articles (in Java)
Using Charts in JasperReports
Introducing Nested and Inner Classes
Increment and Decrement Operator
Tomcat and httpd configured in port 8080 and 80
List all the serial and parallel ports in your system using Java
What is Unicode?
StreamTokenizer sample program in Java
FileReader and FileWriter example program in Java
FilenameFilter - sample program in Java
Transient vs Volatile modifiers in Java
Basics of Inheritance in Java
Method Overloading (function overloading) in Java
while - Iteration in java
how to use boolean data type in Java
equals( ) Versus == in Java