title: javascript change text to element's alt text on hover
body: <p>I've got a series of images, and, upon hover, I'd like them to change the text of a <code>&lt;span&gt;</code> element. I accomplished this before with some very redundant javascript, changing the text of the <code>&lt;span&gt;</code> on every onMouseIn and onMouseOut for every image, each with a unique ID. I used this code, repeated several times:</p>
  
  <pre><code>window.onload = function () {
  document.getElementById("foo").onmouseover = function () {
      document.getElementById("element").innerHTML = "bar";
  };
  
  document.getElementById("foo").onmouseout = function () {
      document.getElementById("element").innerHTML = "bar";
  };
  </code></pre>
  
  <p>But I was wondering if there was an easier way to do this, using the <code>alt</code> tag of the image. On image hover, I'd want the <code>&lt;span&gt;</code> tag to display the hovered image's <code>alt</code> text, and onMouseOut, go back to normal. How would this be done? Thanks.</p>