title: How to change background color randomly in HTML with JavaScript?
body: <p>this web page changes the backgrounder color randomly. i am having trouble to do the same thing with "#title" ,but the color stays the same.</p>
  
  <p>please help</p>
  
  <p>Thank you</p>
  
  <p>JavaScript code:</p>
  
  <pre><code>function setbackground()
  {
      window.setTimeout( "setbackground()", 80); //  milliseconds delay
  
      var index = Math.round(Math.random() * 9);
  
      var ColorValue = "FFFFFF"; // default color - white (index = 0)
  
      if(index == 1)
          ColorValue = "66FF33"; 
      if(index == 2)
          ColorValue = "FF0000"; 
      if(index == 3)
          ColorValue = "FF00FF"; 
      if(index == 4)
          ColorValue = "0000FF"; 
      if(index == 5)
          ColorValue = "00FFFF"; 
      if(index == 6)
          ColorValue = "FFFF00"; 
      if(index == 7)
         ColorValue = "CC66FF"; 
      if(index == 8)
          ColorValue = "3366FF"; 
     if(index == 9)
          ColorValue = "CCCCCC"; 
  
     document.getElementsByTagName("body")[0].style.backgroundColor = "#" + ColorValue;
  
  }
  
  function setbackgroundTitle()
  {
      window.setTimeout( "setbackgroundTitle()", 600); //  milliseconds delay
  
      var index = Math.round(Math.random() * 4);
  
      var ColorValue = "FFFFFF"; // default color - white (index = 0)
  
      if(index == 1)
          ColorValue = "66FF33"; 
      if(index == 2)
          ColorValue = "FF0000"; 
      if(index == 3)
          ColorValue = "FF00FF"; 
      if(index == 4)
          ColorValue = "0000FF"; 
  
  
      document.getElementById("title")[0].style.backgroundColor = "#" + ColorValue;
  
  }
  </code></pre>
  
  <p>CSS code:</p>
  
  <pre><code>#title{
      background-color:#11f22f;
      height:300px;
      width:400px;
      margin:25px auto 0 auto;
      -moz-border-radius:25px;
      -webkit-border-radius:25px;
  }
  </code></pre>
  
  <p>html Code:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
          &lt;title&gt;HomeWork&lt;/title&gt;
          &lt;script type="text/javascript" src="crazy.js"&gt; &lt;/script&gt;
          &lt;link rel="stylesheet" type="text/css" href="HomeWork2.css" /&gt;
  
      &lt;/head&gt;
      &lt;body&gt;
  
      &lt;body onload="setbackground();"&gt;
          &lt;div id="title" onload="setbackgroundTitle();"&gt; hjhjhkj dfvdfsv dfgvkdfsk dfs&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>