title: Javascript addEventListener - using to create a mouseover effect?
body: <p>I have a div with an id of "button". I am trying to change its background to become blue when I hover (without using the CSS hover selector). </p>
  
  <pre><code>var item = document.getElementById("button");
  item.addEventListener("mouseover", func, false);
  
  function func()
  {  
     var item = document.getElementById("button");
     item.setAttribute("style", "background-color:blue;")
  }
  </code></pre>
  
  <p>This, however, only sets the color of the item to blue when I hover, but does not reset it to white after I move mouse away. How can I correct this? (btw, mouseenter and mouseleave do not work with this seemingly). </p>