2012-06-08 92 views
0

我向FF寫入擴展名,這部分代碼在早期版本6.0-8.0上不起作用。 但在12.0-13.0版本中,一切都很好。是什麼原因?FF mouseleave/mouseenter events

 for(var i = 0; i < doc.getElementsByClassName('repInfo').length; i++) 
     { 
      doc.getElementsByClassName('repInfo')[i].getElementsByTagName('a')[0].style.visibility = "hidden"; 
      doc.getElementsByClassName('repInfo')[i].getElementsByTagName('a')[1].style.visibility = "hidden"; 

      doc.getElementsByClassName('repInfo')[i].addEventListener('mouseleave', 
       function(e) { 
        e.target.getElementsByTagName('a')[0].style.visibility = "hidden"; 
        e.target.getElementsByTagName('a')[1].style.visibility = "hidden"; 
       }, false); 
      doc.getElementsByClassName('repInfo')[i].addEventListener('mouseenter', 
       function(e) { 
        e.target.getElementsByTagName('a')[0].style.visibility = "visible"; 
        e.target.getElementsByTagName('a')[1].style.visibility = "visible"; 
       }, false); 
     } 
+1

挑剔:'doc.getElementsByClassName( 'repInfo')[I] ...'用於一遍一遍是不好的性能。將其設置爲一個變量並從那裏開始工作。 – epascarello

回答