Tags for this article: document object model, dom level 0, html, javascript, w3c
The DOM or the Document Oriented Model is an interface that allows the scripts and programs to update the style, structure and content of the documents dynamically. DOM is a platform and language neutral. DOM is neither in HTML nor in JavaScript. It is a type of glue, which binds both HTML and JavaScript together.
DOM Level 0
The level 0 DOM is just a mix of all the HTML functions, which have not been specified formally that will allow the scripting languages to interact with the Netscape Navigator 3.0 and Microsoft Internet Explorer 3.0. All these basically mean that, if the DHTML pages are compliant with the DOM level 0 and then it has to work reliably fair with the old browsers.
The document master container of the DOM level 0 is the base structure. This mainly refers to the entire document and it includes all the elements within it and it is directly referenced as:
Document
It is directly referenced as document because, DOM level 0 is very much basic and it allows only the developer to manipulate the items on pages that have some level of interactivity already that is the forms. In the Web document, it is very much possible to reference the other items but most of the browsers do not support the interactivity with them at this level 0.
Referencing Forms
Using the DOM level 0, actually there are three ways to reference the form control and they are
It’s by name or by ID
This is one of the easiest ways of referencing a form control as you will be able to see in XHTML to which form you are referring to. For ex, this is the name which is named as ‘form1’.
“<form name=”form1″ id=”form1″>…</form>”
In the DOM, it can be referenced as
“document.form1”
If at all you want to reference one of the elements within the form, you would be able to name it as well:
“document.form1.fname”
References as
“<input type=”text” name=”fname” />”
In the form mentioned above
By number
each element and form within the form is just given by a number in one of the array and is starts with 0. They’re numbered with first <form> element found in flow of the document. In order to refer the second form on this page:
Document. Form [1]
Then, in order to refer the second form element within the second form will be
‘Document. Form [1].element [1]’
Combination of both
It is very much possible to use any type of combination using the name or number to reference a form element or form within the document:
“document.form [0].fname”
“document.form1.element [3]”
Other DOMs
W3C has many recommendations for various level of DOM. All these levels will provide more power and control over all the Web documents but there are DOMs for many other user agents and browsers as well. All these DOMs aren’t standardized but for a specific browser, if you want to write the DHTML it will really help you to learn the specific DOM for a particular browser.