DOM

Methods

getElementById

We could extend the object to an element's style, for instance:

document.getElementById("myDiv").style.backgroundColor="#ffffff";
 

We could set the styles for almost any element in the body of a document, be it a division element (as in our example) or a paragraph element or a span element or a list element, etc.

Next >


< Previous

[Page Top]

Introduction to DOM, by Dr Sam
copyright | contact
published by OxfordU.net

[An alternative, straight-text version is also available.]

Web-Design Tutorials by Dr Sam