DHTML Document Object Model

The Document Object Model gives us access to every element in a document.

Note: Most of the DHTML examples require IE 4.0+, Netscape 7+, or Opera 7+!

How to access an element?

The element must have an id attribute defined and a scripting language is needed. JavaScript is the most browser compatible scripting language, so we use JavaScript.

<h1 id="header">My header</h1>
<script type="text/javascript">

The script changes the color of the header element, and produces this output.

My header

Comments are closed.