Docsity

JavaScript Objects and Models: BOM and DOM, Exercises of Programming Languages

Toggle sidebar
bg1
Modern Programming Languages
Lecture # 39
Objects
• An object is a collection of data types as well as functions in one package
• The various data types called properties and functions called methods are
accessed using the dot notation
– objectname.propertyname
Objects
• There are many types of objects in JavaScript
– Built-in objects (primarily type related)
– Browser objects (navigator, window etc.)
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download JavaScript Objects and Models: BOM and DOM and more Exercises Programming Languages in PDF only on Docsity!

Modern Programming Languages

Lecture # 39

Objects

• An object is a collection of data types as well as functions in one package

• The various data types called properties and functions called methods are

accessed using the dot notation

– objectname.propertyname

Objects

• There are many types of objects in JavaScript

– Built-in objects (primarily type related)

– Browser objects (navigator, window etc.)

  • Document objects (forms, images etc.)
  • User defined objects

Two Object Models

  • In JavaScript, two primary object models are employed
  • Browser Object Model (BOM)
    • The BOM provides access to the various characteristics of a browser such as the browser window itself, the screen characteristics, the browser history and so on.
  • Document Object Model (DOM)
    • The DOM on the other hand provides access to the contents of the browser window, namely the documents including the various HTML elements ranging from anchors to images as well as any text that may be enclosed by such element.

Object Statement: With

document.write(“Hello World”); document.write(“
”); document.write(“this is another write statement”);

with (document) { write(“Hello World”); write(“
”); write(“this is another write statement”);

Modern Programming Languages

Lecture # 40

Names