Wednesday, June 18, 2008

Window Object in JavaScript


Window Object in JavaScript

Some Syntax...

To get default text in the statusbar of the window
var status = window.defaultStatus;

To get text in the statusbar of a window
var status = window.status;

To get window name
var winName = window.name;

To remove focus from the current window
window.blur();

To set focus to the current window
window.focus();

To get the outer height of a window in pixels
var outerheight= window.outerheight;

To get the outer width of a window in pixels
var outerwidth= window.outerwidth;

To get reference to the current window
window.self;

To get topmost ancestor window
window.top;

To moves a window a specified number of pixels relative to its current coordinates
window.moveBy(x,y);

To moves a window's left and top edge to the specified coordinates
window.moveTo(x,y);

To resize a window by the specified pixels
resizeBy(width,height);

To resize the window to the specified width and height
resizeTo(width,height);

To scroll the content by the specified number of pixels
scrollBy(xnum,ynum);

To scrolls the content to the specified coordinates
scrollTo(xpos,ypos);

To print the contents of the current window
window.print();

To open a new browser window
window.open(URL,name,specs,replace);

To close the current window
window.close();

To check window has been closed
var closed = window.closed;

No comments: