JavaScript Object

JavaScript Object

JavaScript treats elements that appear on our navigator window as an object, which means that elements:
  • Classified according to the hierarchy / level specific so that we can know where the location of the object actually.
  • Where we associate with the condition or nature of the special nature (properties)
JavaScript divide a single Navigator page in a variety of objects, with the aim to facilitate us to access one of them and manipulate them by changing the nature / conditions (properties) to them.

We start from the object of the greatest among them (which contains all other objects), then we go down based on the level or hierarchy to the objects we want.

  • The largest object is window of the navigator.
  • In the object window, there is an object that is displayed in the form of a page, we call it document object
  • Pages that contain many objects, formulas, text, images and more others ..

To access an object, we must access the largest object first (in this case is window object)

For example, in a window, there is one form with the name Form1

window.document.forms ["Form1"]

In the form there is a checkbox with name checkbox1.

window.document.forms ["Form1"]. checkbox1

And in the form, there is a single textfield with the name textfield1.

window.document.forms ["Form1"]. textfield1


Post a Comment