BLOG HOME -  UK WEB HOSTING -  PHP MYSQL HOSTING -  RESELLER HOSTING -  eUKhost FORUMS -  VPS HOSTING

‘window.open()’ Method In Javascript

When developers want to open a new window then usually use the window.open() method of javascript.
Though it is a simple method, many developers find it difficult to remember its syntax.
Syntax of window.open() :
window.open(’URL’,'window name’ [,window attributes]);

URL = Address of the web page you want to open.

window name = Name of the window.

and there are number of window attributes of window.open() available which you can use :

scrollbars=yes|no - specifies whether the new window should have scrollbars.
resizable=yes|no - specifies if the window is resizable.
width=pixels - the width of the new window is specified in pixels and is in numerical format.
height=pixels - the height of the new window is specified in pixels and is in numerical format.
top=pixels - specifies the Y coordinate of the top left corner of the new window.
left=pixels - specifies the X coordinate of the top left corner of the new window.

These are the most important parameters of the window, however there are other parameters like :

toolbar=yes|no - specifies whether to display the toolbar in the new window.
location=yes|no - specifies whether to display the address line in the new window.
status=yes|no - specifies whether to display the browser status bar.
menubar=yes|no - specifies whether to display the browser menu bar.

Example of window.open() :

window.open(’index.html’,'welcome window’,’scrollbars=yes,width=500,height=600,menubar=no’);

If a window with the name you have specified already exists, then window.open() will display the new content in that existing window, rather than creating a new one.

digg this


This post is compiled by eUKhost.com

Leave a Comment

You must be logged in to post a comment.