title: Changing color JavaScript doesn't work
body: <p>My problem is: I have three elements on a list, and I have to keep changing the text color when the mouse is hover.</p>
  
  <p>So I am building 3 different functions, because the colors are different.</p>
  
  <p>What I did is:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
   var links  = document.getElementsByClassName("menuitems");
   function firsthover()
  {
     links[0].style.color = "rgb(204, 0, 0)"; /*this is for avoiding setInterval delay*/
  
       setInterval(function(){
       if(links[0].style.color == "rgb(204, 0, 0)")
       { 
       links[0].style.color = "rgb(235, 153, 153)";
       }
  
       if(links[0].style.color == "rgb(235, 153, 153)")
       {
       links[0].style.color = "rgb(204, 0, 0)";
       }
  
      },1150);
  }
   &lt;/script&gt;
  </code></pre>
  
  <p>The problem is: it changes the color just once.</p>
  
  <p>I tried to use hexadecimal color too, just doesn't work.</p>
  
  <p>Please be patient, I am still a novice.</p>