title: How to get index value of an element while onmouseover?
body: <p>I am trying to get an element's index number while onmouseover.<br>
  I can do this easily with jQuery but native javascript is bulletproof /:</p>
  
  <p><a href="http://jsfiddle.net/5DAFx/1/" rel="nofollow">Here is jsFiddle</a> </p>
  
  <pre><code>var ele = document.getElementsByClassName('sample')[0];
  
  for(i=0; i&lt;ele.children.length;i++){
      ele.children[i].onmouseover = function() {
          this.style.background='red';
          alert(i);//can't get the value
      }
  }
  
  &lt;ul class="sample"&gt;
      &lt;li&gt;&lt;/li&gt;
      &lt;li&gt;&lt;/li&gt;
      &lt;li&gt;&lt;/li&gt;
      &lt;li&gt;&lt;/li&gt;
      &lt;li&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>