Logo

Navigation
  • Home
  • Services
    • ERP Solutions
    • Implementation Solutions
    • Support and Maintenance Solutions
    • Custom Solutions
    • Upgrade Solutions
    • Training and Mentoring
    • Web Solutions
    • Production Support
    • Architecture Designing
    • Independent Validation and Testing Services
    • Infrastructure Management
  • Expertise
    • Microsoft Development Expertise
    • Mobile Development
    • SQL Server Database and BI
    • SAP BI, SAP Hana, SAP BO
    • Oracle and BI
    • Oracle RAC
  • Technical Training
    • Learn Data Management
      • Business Intelligence
      • Data Mining
      • Data Modeling
      • Data Warehousing
      • Disaster Recovery
    • Learn Concepts
      • Application Development
      • Client Server
      • Cloud Computing Tutorials
      • Cluster Computing
      • CRM Tutorial
      • EDI Tutorials
      • ERP Tutorials
      • NLP
      • OOPS
      • Concepts
      • SOA Tutorial
      • Supply Chain
      • Technology Trends
      • UML
      • Virtualization
      • Web 2.0
    • Learn Java
      • JavaScript Tutorial
      • JSP Tutorials
      • J2EE
    • Learn Microsoft
      • MSAS
      • ASP.NET
      • ASP.NET 2.0
      • C Sharp
      • MS Project Training
      • Silverlight
      • SQL Server 2005
      • VB.NET 2005
    • Learn Networking
      • Networking
      • Wireless
    • Learn Oracle
      • Oracle 10g
      • PL/SQL
      • Oracle 11g Tutorials
      • Oracle 9i
      • Oracle Apps
    • Learn Programming
      • Ajax Tutorial
      • C Language
      • C++ Tutorials
      • CSS Tutorial
      • CSS3 Tutorial
      • JavaScript Tutorial
      • jQuery Tutorial
      • MainFrame
      • PHP Tutorial
      • VBScript Tutorial
      • XML Tutorial
    • Learn Software Testing
      • Software Testing Types
      • SQA
      • Testing
  • Career Training
    • Career Improvement
      • Career Articles
      • Certification Articles
      • Conflict Management
      • Core Skills
      • Decision Making
      • Entrepreneurship
      • Goal Setting
      • Life Skills
      • Performance Development
      • Personal Excellence
      • Personality Development
      • Problem Solving
      • Relationship Management
      • Self Confidence
      • Self Supervision
      • Social Networking
      • Strategic Planning
      • Time Management
    • Education Help
      • Career Tracks
      • Essay Writing
      • Internship Tips
      • Online Education
      • Scholarships
      • Student Loans
    • Managerial Skills
      • Business Communication
      • Business Networking
      • Facilitator Skills
      • Managing Change
      • Marketing Management
      • Meeting Management
      • Process Management
      • Project Management
      • Project Management Life Cycle
      • Project Management Process
      • Project Risk Management
      • Relationship Management
      • Task Management
      • Team Building
      • Virtual Team Management
    • Essential Life Skills
      • Anger Management
      • Anxiety Management
      • Attitude Development
      • Coaching and Mentoring
      • Emotional Intelligence
      • Stress Management
      • Positive Thinking
    • Communication Skills
      • Conversation Skills
      • Cross Culture Competence
      • English Vocabulary
      • Listening Skills
      • Public Speaking Skills
      • Questioning Skills
    • Soft Skills
      • Assertive Skills
      • Influence Skills
      • Leadership Skills
      • Memory Skills
      • People Skills
      • Presentation Skills
    • Finding a Job
      • Etiquette Tips
      • Group Discussions
      • HR Interviews
      • Interview Notes
      • Job Search Tips
      • Resume Tips
      • Sample Resumes
 

JavaScript Windows Object Properties Part II

By Exforsys | on August 9, 2007 |
JavaScript Tutorial

JavaScript Windows Object Properties Part II

In this JavaScript tutorial, you will learn about screenX, screenY, screenLeft and screenTop, top, length, frames, opener, parent and window property of Window object along with syntax and examples.

screenX:

This property screenX returns the x coordinate of the window relative to the user’s monitor screen. In other words this property namely ScreenX indicates in pixels the distance that the new window is placed from the left side of the screen horizontally. This property is a read onlywrite property.

General syntax for using this screenY property of Window object is as follows:

window.screenX  

screenY:

This property screenY returns the y coordinate of the window relative to the user’s monitor screen. In other words this property namely ScreenY indicates in pixels the distance that the new window is placed from the left side of the screen vertically. This property is a read only property.

General syntax for using this screenY property of Window object is as follows:

window.screenY

screenLeft and screenTop:

These are read only properties and these properties returns the pixel position of the main window relative to top-left corner of the screen.

General syntax for using this screenLeft and screenTop property of Window object is as follows:

window.screenLeft

window.screenTop

Let us see an example to illustrate the use of the above screenLeft and screenTop properties of Window object.


<html>
   <
head>
      <
script type="text/javascript">
         function Getcoordinate()
         {
         var x = ""
         var y = ""
         x = "Value of Left coordinate is: " +          window.screenLeft + "\n";
         alert(x);
         y = "Value of Top coordinate is: " +          window.screenTop + "\n";
         alert(Y);
         }

      </script>
   <
/head>
 

   <body>
       <input type="button" onclick="Getcoordinate()"
        value="Coordinate Value">

   </body>
</
html>

In the above example the function Getcoordinate() displays the Left and Top coordinate of the Screen using the window.screenLeft and window.screenTop properties in it respectively.

top:

The top property is different from screenTop property. The top property returns the topmost ancestor window in other words returns a reference to the parent window.

General syntax for using the top property of Window object is as follows:

window.top

length:

This property is used to set or return the number of frames contained in a window. The length property of a Window Object returns the number of child frames contained within a window. The result returned by the length property of a Window Object has the same result when using the length property of the frames array.

General syntax of length property of Window Object:

window.length

frames:

The frames property references all the named child frames in the current window by representing in an array. The frame property of a window object is an array containing window objects. In this array, each one refers to the content of a frame within the window, meaning that each one refers to a separate frame.

NOTE: Every window refers to a frames array, which contains a list of frames within that window. Each frame contains a different window. The document.frames property is different from the window.frames property and rarely used in JavaScript.

General syntax of frames property of Window Object:

window.frames ( = "frameID")

The frameID in the above is optional. The references are stored in the array in the order that they are defined in the source code. If a programmer wishes to access items in the array, the frameID can be used. The frameID can be the framename defined with the &lt;FRAME&gt; tag in the HTML source. This is given as a String representation and can also be represented as an integer. If a programmer wishes to represent the frameID as an integer, note that ‘0’ is always the first element in the array.

To access the elements, the programmer can represent as follows:

window.frames[0]

window.frames[1]

or as

window.frames["Exforsys"]

It is also possible to count the number of child frames contained within a window by combining the frames property with the length property as window.frames.length property.

opener:

A window is opened using window.open. From the destination window, if the programmer wishes to return details of the source window, the opener property of the window object can be used. The opener property returns a reference to the window that created the window.

General syntax of opener property of Window Object:

window.opener

A new window has a reference to the window that opened it stored in the opener property. The opener property is applicable only on the topmost window object of the new window.

An example to understand the opener property of window object:


<html>
   <
body>
      <
script type="text/javascript">
         var exfWin =
         window.open(“http://www.exforsys.com/”,
         “testwindow”,
         “height=200,width=350,top=20,left=20,
         resizable=yes”);
         alert(exfWin.opener == window);

      </script>
   </
body>
</
html>

The output of the above example is

true

The new window named exfWin is opened and then the opener property of this exfWin window is tested against the window object. This returns true since the window that opened the exfWin was the current window.

parent:

The parent property of a window object returns the parent window. The parent property references the window that contains the calling child frame.

General syntax of parent property of Window Object:

window.parent

In the top level of windows, the parent property is the same as the self property of window object.

An example to understand the parent property of a window object:


<html>
   <
head>
      <
script type="text/javascript">
         function Exforwin()
         {
         var Exfor = ""
         Exfor += "Parent name of Window is: " +         
         window.parent + "\r"
         alert(Exfor)
         }     

           </script>

   </head>

   <body>


   </
body>
</
html>

The output of above program is a button with message

Click to see the Output

When this button is clicked, the output displayed is:

Parent name of Window is: Exforsys

window:

The window property of a window object is used to refer to the current window. The window property is another name for the self property.

General syntax of window property of Window Object:

window.window

Since the self property of window object is the same as window property of a window object, it is very clear that all the following representations are the same:

window.self
window.window
self.self
self.window.self

« « JavaScript Windows Object Properties Part I
JavaScript Math Object » »

Author Description

Avatar

Editorial Team at Exforsys is a team of IT Consulting and Training team led by Chandra Vennapoosa.

Free Training

RSSSubscribe 392 Followers
  • Popular
  • Recent
  • JavaScript Two Dimensional Arrays

    June 7, 2007 - 0 Comment
  • JavaScript FileUpload Object

    May 18, 2007 - 0 Comment
  • JavaScript Introduction

    April 5, 2007 - 0 Comment
  • JavaScript Confirm Box

    April 25, 2007 - 0 Comment
  • JavaScript Location Object

    July 4, 2007 - 0 Comment
  • JavaScript Array Operations

    July 29, 2007 - 0 Comment
  • JavaScript Form Object

    May 19, 2007 - 0 Comment
  • JavaScript Features

    April 24, 2007 - 0 Comment
  • JavaScript Objects

    August 12, 2007 - 0 Comment
  • JavaScript Window Object Timeout Methods

    August 8, 2007 - 0 Comment
  • JavaScript Objects

    August 12, 2007 - 0 Comment
  • JavaScript String Object

    August 12, 2007 - 0 Comment
  • JavaScript Date Object

    August 12, 2007 - 0 Comment
  • JavaScript Math Object

    August 9, 2007 - 0 Comment
  • JavaScript Windows Object Properties Part I

    August 8, 2007 - 0 Comment
  • JavaScript Window Object Timeout Methods

    August 8, 2007 - 0 Comment
  • JavaScript Document Object Methods Part II

    August 7, 2007 - 0 Comment
  • JavaScript Document Object Methods Part I

    August 5, 2007 - 0 Comment
  • JavaScript History Object Properties and Methods

    August 5, 2007 - 0 Comment
  • JavaScript Elements and Embed Objects

    August 4, 2007 - 0 Comment

Exforsys e-Newsletter

ebook
 

Related Articles

  • JavaScript Objects
  • JavaScript String Object
  • JavaScript Date Object
  • JavaScript Math Object
  • JavaScript Windows Object Properties Part I

Latest Articles

  • Project Management Techniques
  • Product Development Best Practices
  • Importance of Quality Data Management
  • How to Maximize Quality Assurance
  • Utilizing Effective Quality Assurance Strategies
  • Sitemap
  • Privacy Policy
  • DMCA
  • Trademark Information
  • Contact Us
© 2023. All Rights Reserved.IT Training and Consulting
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.AcceptReject Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT