W3C.US

  • Increase font size
  • Default font size
  • Decrease font size
Home Tutorial Javascript Book Javascript & DOM (1)

Javascript & DOM (1)

E-mail Print PDF

What's DOM?

DOM is Document Object Model. Document object is the part of a document. In a html document, the base document objects that javascript can access include: window, document, location, navigator, screen and history etc.

If we want to refer a document object in the page, we must list all of its parent's node. For example, we want to get the object of the form “applicationForm”'s Textinput “customerName”, we should use document.applicationForm.customerName to get it.

The table below show the common document object in HTML pages, the left column is the object name, some names start with capital letters, then we can access them by their Id or Name:

document.getElementById("itsid");

document.getElementByName("itsname");

navigator navigator object
screen screen object
window window object
history history object
location location object
frames[]; Frame frame object
document document object
anchors[]; links[]; Link link object
applets[] Java applet object
embeds[] embed plugin object
forms[]; Form form object
Button button object
Checkbox checkbox object
elements[]; Element form element object
Hidden hidden object
Password password input object
Radio radio object
Reset reset button object
Select select area object
options[]; Option option object
Submit submit button object
Text text input object
Textarea text area object
images[]; Image image object