Javascript: DOM 2
Lets say we have the HTML below and I want to change the color of the text in the div element "content" to red.
...
<body onload="setColorRed()">
<div id="content">
<p>The <em>quick</em> brown fox jumped over the log.</p>
</div>
</body>
...
I could use the following Javascript.
function setColorRed(){
var mycontent = document.getElementById("content");
mycontent.style.color = "red";
}