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
 

Working with JavaScript DOM Objects

By Exforsys | on June 4, 2007 |
JavaScript Tutorial

Working with JavaScript DOM Objects

In this JavaScript tutorial, you will learn about DOM object – window, properties of window object, methods of window object, screen, properties of screen object, navigator, properties of navigator object, methods of navigator object, history, property of history object, methods of history object, location, properties of location object and methods of location object.

DOM stands for Document Object Model. Document Object Model or DOM is a set of objects that allow programmers scripts to integrate with the browser and work with documents, windows, forms, and other components.

The biggest feature that JavaScript has over basic HTML is that scripts can manipulate the web document and its contents. JavaScript can load a new page onto the browser, work with parts of the browser window and document, open new windows, and even modify text dynamically within the page. To work with the browser and documents, JavaScript uses a hierarchy of parent and child objects called the Document Object Model or DOM. These objects are organized into a tree-like structure, and represent all of the content and components of a web document.

All objects in JavaScript have properties and methods associated with them. Document Object Model has properties and methods associated with it. The properties of the Document Object Model are used to describe the web page or document and the methods of the Document Object Model are used for working with parts of the web page. A detailed study of these methods and properties will be made in the coming sections.

The HTML DOM is an abbreviation denoting the Document Object Model for HTML. It is a standard defined by W3C. The HTML DOM defines a standard set of objects for HTML, and a standard way to access and manipulate HTML documents. Adding new elements or modifying the contents of the elements using DOM can manipulate HTML elements. HTML DOM is a language independent platform. DOM is technically separate from JavaScript and can be accessed using other scripting languages.

The following list denotes HTML DOM objects that are used for providing information about the environment of the user’s system. These objects are used to provide various information about the user’s environment like screen size, resolution, monitor depth, browser history, the URL, operating system, browser type, version, language and so on. The objects are:

  • Window
  • Screen
  • Navigator
  • History
  • Location

Associated with each of these objects are properties and methods.

Window:

With respect to the hierarchy of JavaScript, the Window object is the top level object. The Window object denotes the browser window.

The following list gives some of the properties and methods of the Window object.

Properties of Window Object:

  • closed
  • document
  • defaultStatus
  • frames
  • history
  • length
  • location
  • name
  • opener
  • parent
  • personalbar
  • self
  • status
  • statusbar
  • scrollbars
  • top
  • toolbar
  • window
  • innerWidth
  • innerHeight
  • outerWidth
  • outerHeight
  • pageXOffset
  • pageYOffset
  • screenX
  • screenY
  • screenLeft
  • screenTop

Methods of Window Object:

  • alert()
  • blur()
  • clearInterval()
  • clearTimeout()
  • close()
  • confirm()
  • createPopup()
  • focus()
  • moveBy()
  • moveTo()
  • open()
  • print()
  • prompt()
  • resizeBy()
  • resizeTo()
  • scrollBy()
  • scrollTo()
  • setInterval()
  • setTimeout()

Screen:

Screen object object contains information about the display screen of the client. The object provides information about the user’s video display and color settings. JavaScript runtime engine automatically creates these settings.

There are various properties associated with the Screen object.

Properties of Screen Object:

  • availHeight
  • availWidth
  • bufferDepth
  • colorDepth
  • deviceXDPI
  • deviceYDPI
  • fontSmoothingEnabled
  • height
  • logicalXDPI
  • logicalYDPI
  • pixelDepth
  • updateInterval
  • width

In the next sections, the usage, syntax and explanation with examples of each of the properties of the Screen object will be discussed.

Navigator:

Navigator object is an object that is automatically created JavaScript runtime engine. Navigator contains information about the client browser.

This object is used to obtain information about the type of browser being used to access the page. Using this information, the user can be directed to a different page or carry out tasks or functions depending upon the user’s browser.

The following list gives some of the properties and methods of the Navigator object.

Properties of Navigator Object:

  • appCodeName

  • appMinorVersion

  • appName

  • appVersion

  • browserLanguage

  • cookieEnabled

  • cpuClass

  • onLine

  • platform

  • systemLanguage

  • userAgent

  • userLanguage

Methods of Navigator Object:

  • javaEnabled()
  • taintEnabled()

History:

Like the Screen Object, the History object is also automatically created object by the JavaScript runtime engine. Browsers store the list of the user’s previously visited URLs. Using this list, the user navigates to previously visited web pages using the back and forward buttons in the browser. This list of URLs is called the browser’s history. It’s stored in the form of a list that can be accessed by JavaScript. History object can be assessed by using the window.history property. The History object is a part of a Window object.

The following list gives some of the properties and methods of the History object.

Property of History Object:

  • length

Methods of History Object:

  • back()
  • forward()
  • go()

Syntax and explanation with examples of History object properties and methods are discussed in coming sections.

Location:

Location object contains information about the current URL and thus this object provides access and control over the URL of the current window. But one important point to note in this context is that it cannot modify the URL displayed in the browser’s address box and thus adds security in its usage. Since it is part of the Window object it is accessed using the window.location property.

Location Object is automatically created by the JavaScript runtime engine. The following list gives some of the properties and methods of the Location object.

Properties of Location Object:

  • hash
  • host
  • hostname
  • href
  • pathname
  • port
  • protocol
  • search

Methods of Location Object:

  • assign()
  • reload()
  • replace()
  • « « English Language and Career Advancement
    History of Neuro Linguistic Programming (NLP) » »

Author Description

Avatar

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

Free Training

RSSSubscribe 391 Followers
  • Popular
  • Recent
  • 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 Events Handling

    May 20, 2007 - 0 Comment
  • JavaScript Frame object

    May 20, 2007 - 0 Comment
  • JavaScript DOM Window Object

    June 21, 2007 - 0 Comment
  • JavaScript String Object

    August 12, 2007 - 0 Comment
  • JavaScript Window Object Open Method

    July 4, 2007 - 0 Comment
  • JavaScript Event Handler

    August 2, 2007 - 0 Comment
  • JavaScript Browser Objects Part 2

    June 13, 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 II

    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

Exforsys e-Newsletter

ebook
 

Related Articles

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

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