Riporto il codice

codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/strict.dtd">

<html>
<head>
<title>DOM Example</title>

<script language="JavaScript">

function changeBgColor(newColor)
{

    if(document.body)
    {
    eval('document.body.bgColor="' + newColor + '"');
    }

}

function tackOn(headingText)
{
  if (document.body)
     {
     if (headingText)    
         {
         var newHeading = document.createElement("h1");
         someText = document.createTextNode(headingText);
         newHeading.appendChild(someText);       
         document.body.appendChild(newHeading);
         }
     }
}

function setHeadingColors
{
   var headings = document.getElementsByTagName("h1")
   for (var i=0; i < headings.lenght;i++)
   {
   headings.item(i).style.color = "yellow";
   }

}
</script>
</head>
<body>

<form>

Background color:
<select onchange="changeBgColor(this.options[this.selectedIndex].value);">
  <option value="white">White</option>
  <option value="red">red</option>
  <option value="blue">blue</option>
</select>


Add heading:
<input type="text" value="Spam" id="newHeading"/>
<input type="button" value="tack it on" onclick="tackOn(document.getElementById('newHeading').value);">


<input type="button" value="change colors" onclick="setHeadingColors();" />


</form>

</body>
</html>
Il sistema operativo che sto usando è fedora 9 su browser mozilla firefox 3.0.11
Grazie