Best Windows Hosting

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Friday, 11 May 2012

Window Object in Javascript: Properties and Methods

Posted on 08:57 by Unknown
1 The Window object is the top level object and represents the window of the browser.

2. Window objects are either the current window (if the browser is displaying only a single document), or those created with a window.open() method (where the name is specified in the code), or separate frames, if the document is laid out using a <FRAMESET> definition (where the windows are named in the <FRAME> element).

3. As the Window object is the top level object in the object hierarchy and the existance of the current window is assumed, most Window properties need not be prefixed by Window. For example, the following two references are identical :

window.defaultStatus
defaultStatus

and would both return the default text of the status bar for the current window.

4. Difference between Window and Documnet Objects:

Window is the first thing that gets loaded into the browser. The document object is your html document that will be loaded into the browser. The Document object provides access to all HTML elements in a page, from within a script. The document actually gets loaded inside the window object. The Document object is a part of the Window object, and can be accessed through the window.document property.

Window Objecy Properties

closed: Returns a Boolean value indicating whether a window has been closed or not
defaultStatus: Sets or returns the default text in the statusbar of a window
document: Returns the Document object for the window
frames: Returns an array of all the frames (including iframes) in the current window
history: Returns the History object for the window
innerHeight: Sets or returns the inner height of a window's content area
innerWidth: Sets or returns the inner width of a window's content area
length: Returns the number of frames (including iframes) in a window
location: Returns the Location object for the window
name: Sets or returns the name of a window
navigator: Returns the Navigator object for the window
opener: Returns a reference to the window that created the window
outerHeight: Sets or returns the outer height of a window, including toolbars/scrollbars
outerWidth: Sets or returns the outer width of a window, including toolbars/scrollbars
pageXOffset: Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window
pageYOffset: Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window
parent: Returns the parent window of the current window
screen: Returns the Screen object for the window
screenLeft: Returns the x coordinate of the window relative to the screen
screenTop: Returns the y coordinate of the window relative to the screen
screenX: Returns the x coordinate of the window relative to the screen
screenY: Returns the y coordinate of the window relative to the screen
self: Returns the current window
status: Sets the text in the statusbar of a window
top: Returns the topmost browser window

Window Object Methods

alert(): Displays an alert box with a message and an OK button
blur(): Removes focus from the current window
clearInterval(): Clears a timer set with setInterval()
clearTimeout(): Clears a timer set with setTimeout()
close(): Closes the current window
confirm(): Displays a dialog box with a message and an OK and a Cancel button
createPopup(): Creates a pop-up window
focus(): Sets focus to the current window
moveBy(): Moves a window relative to its current position
moveTo(): Moves a window to the specified position
open(): Opens a new browser window
print(): Prints the content of the current window
prompt(): Displays a dialog box that prompts the visitor for input
resizeBy(): Resizes the window by the specified pixels
resizeTo(): Resizes the window to the specified width and height
scroll(): Scrolls the window
scrollBy(): Scrolls the content by the specified number of pixels
scrollTo(): Scrolls the content to the specified coordinates
setInterval(): Calls a function or evaluates an expression at specified intervals (in milliseconds)
setTimeout(): Calls a function or evaluates an expression after a specified number of milliseconds

Email ThisBlogThis!Share to XShare to Facebook
Posted in Javascript | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Online Marketing Degrees
    Because global competition has become so intense, it should come as no surprise that companies invest heavily in their marketing and promoti...
  • Protecting E-mail Addresses on Webpages: Beware of using mailto protocol
    Placing an e-mail address on a Web page is a dangerous prospect nowadays. If the document on which the address appears generates even a medi...
  • Silver Bullets for Testing
    Know Our Application Don’t start testing without understanding the requirements. If we test without knowledge of the requirements, we will n...
  • Preloading Images: A trick to overcome delays in image-rich webpages loading
    One of the things that can really slow down the display of Web pages is an abundance of images, each one of which can contain the equivalent...
  • Unix Commands which should be on tips of each developer
    General Commands: 1. date: shows date and time 2. history: lists the previously executed commands 3. man ls: shows online documentation by...
  • Online Music Degrees
    For those who want to pursue a music degree but find it difficult to do so because of time constraints, financial difficulties or physical l...
  • Client Side State Management in ASP.NET
    State Management in done on client side as well as on server side in ASP.NET. In this article, we will just focus on clinet side state manag...
  • Frameset, Frame and IFrame Elements in HTML
    Frame Element With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and...
  • 5 E-mail Etiquette You Must Know
    From memos and letters to answering machines, voice mail and now email, the last one is here to stay. Studies show that nearly two million e...
  • Cautions while dropping a tablespace
    DROP TABLESPACE drops the tablespace from database. But, there are few things which you should take care while firing this statement. 1. DRO...

Categories

  • AJAX
  • C++
  • CSS
  • Delphi
  • DOTNET
  • HTML
  • Javascript
  • jQuery
  • Management
  • Online Degrees
  • Oracle
  • Others
  • Phonegap
  • PHP
  • Unix
  • XML

Blog Archive

  • ▼  2012 (155)
    • ►  September (64)
    • ►  August (11)
    • ►  July (4)
    • ►  June (3)
    • ▼  May (25)
      • Positioning Property and Z-Index in CSS
      • Validation Controls in ASP.NET: System.Web.UI.WebC...
      • COM Family: COM+ and DCOM, Interop, RPC and TLB
      • Frameset, Frame and IFrame Elements in HTML
      • List of problems occuring while using html tables
      • Alternative of XML: JSON (JavaScript Object Notation)
      • Basic Points of SOA (Service Oriented Architecture)
      • 11 Commonly used AJAX Frameworks
      • WCF: A SOA based Service Framework
      • WPF (Windows Presentation Foundation): Features
      • Relation between Tablespace, Datafile and Control ...
      • 6 Advantages of using stored procedures in your ap...
      • Window Object in Javascript: Properties and Methods
      • DECODE Function vs CASE Statement in Oracle
      • Oracle Streams: An Overview
      • Network Configuration Files in Oracle
      • 40 Objective Type ASP.NET Interview Questions (Par...
      • SQL Replay: A new feature of Oracle 11g
      • 11 Methods to implement 301 Redirect URLs
      • Partitioned Tables: Types and Advantages
      • ItemDataBound in ASP.NET
      • Protecting E-mail Addresses on Webpages: Beware of...
      • Non Breaking Space vs Zero Width Space in HTML
      • Difference between AJAX and jQuery
      • Preloading Images: A trick to overcome delays in i...
    • ►  April (48)
Powered by Blogger.

About Me

Unknown
View my complete profile