Page 178 - DCAP408_WEB_PROGRAMMING
P. 178
Web Programming
Notes By extending the DOM recognized by JavaScript by embedding JSSS in a web page, developers
of web pages can access every element of a web page whether this element appears on the page
when it is rendered in a client browser or not.
By accessing appropriate properties of the ‘Navigator’ object, (i.e., the Browser), the topmost
object in the DOM, JavaScript can recognize the browser type (i.e., Netscape Navigator, Internet
Explorer, etc.) and subsequently dispatch all HTML pages to the browser from the web server,
with a style based on this knowledge. This is where the power of JavaScript really becomes
visible in providing finely tuned web page content to a client’s browser.
Since JavaScript understands the DOM and can extend the DOM with the use of JSSS in a web
page JavaScript understands ‘Objects’.
All objects have:
Properties that determine the functionality of the object
Methods that allow access to these properties
Events to appropriate JavaScript event handlers.
Hence, when a pre-determined event occurs the code snippet will execute. This is the traditional
Object, Event driven, Code execution model of any object based programming environment.
Using appropriate JavaScript snippets, which reference the properties of an object via its built-
in methods, developers of web pages can actually control the functionality of any HTML, object
in the DOM (or extended DOM) while the HTML program executes (i.e., at run time).
Notes JavaScript can access the methods of all objects belonging to the DOM and JSSS
DOM. Hence using JavaScript, truly interactive web pages can be created.
JavaScript features are generated towards providing developers the capability to quickly generate
scripts that will execute in the context of a web page within a JavaScript enabled browser or on
a web server that understands JavaScript.
Although JavaScript does not provide all of the features of a full object oriented programming
language, it does provide a suite of object-based features that are especially tailored to Browser
or Server side scripting.
These features include the recognition of a number of predefined browser and server objects.
JavaScript has the ability to control the behavior of these objects through their properties and
methods.
Self Assessment
Fill in the blanks:
1. Using the Document Object Model (DOM) JavaScript enabled browsers identify the
collection of ………………… objects.
2. The DOM hierarchy continues downward to encompass individual elements on a
‘…………………’.
3. JavaScript’s object hierarchy is mapped to the DOM, which in turn is mapped to the web
page elements in the ………………… window.
172 LOVELY PROFESSIONAL UNIVERSITY