Window Object

By: aathishankaran Emailed: 1598 times Printed: 2044 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 Send SMS using Java Program (full code sample included)
InetAddress Example program in Java
Method Overriding in Java
Using StringTokenizer in Java
How to use ArrayList in Java
How to use Iterator in Java
wait(), notify() and notifyAll() in Java - A tutorial
Recursion in java
Abstract classes in Java
XML and Java - Parsing XML using Java Tutorial
FileReader and FileWriter example program in Java
Method Overloading (function overloading) in Java
Vector example in Java
Read from a COM port using Java program
Garbage Collection in Java
Most Emailed Articles (in Java)
Creating Users and Passwords with Tomcat using tomcat-users.xml
What is a report design in JasperReports?
Reverse a number in Java
Java program to display numbers from 1 to 10 on Applet
Draw a bar chart in Java
Insert, Delete, Search, Print an int Array in Java
HTTPS Java - URL Connection program. Using HttpsURLConnection
Iterate a List in Java
Cannot run program "C:\Program Files\Java\jre6\bin\javac.exe": CreateProcess error=2, The system cannot find the file specified
Using the AWS SDK for Java in Eclipse
inheritance in Java
TCP Server and TCP Client in Java
Java program for Map
How to reverse the elements in a Single dimension array and display the output
Getting Started with Java