Ver Mensaje Individual
  #3 (permalink)  
Antiguo 18/06/2008, 13:12
Jamati
 
Fecha de Ingreso: febrero-2008
Mensajes: 578
Antigüedad: 16 años, 3 meses
Puntos: 3
Respuesta: Pequeña ayuda con getElementsByTagName

Gracias JavierB, pero lamentablemente no me funcionó ...

Adjunto el código con la modificación que me dijiste:

Código HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
ul {margin:0;padding:0;} 
li {list-style:none;}
ul.menu li:hover, ul.menu li.over {background:#FF0000;}
</style>
</head>
<body>
<script type="text/javascript">
startList = function() {
 if (document.all&&document.getElementsByTagName) {
   navRoot = document.getElementsByTagName('ul')[0].className="menu";
   for (i=0; i<navRoot.childNodes.length; i++) {
     node = navRoot.childNodes[i];
     if (node.nodeName=="LI") {
       node.onmouseover=function() {
         this.className+=" over";
       }
       node.onmouseout=function() {
         this.className=this.className.replace(" over", "");
       }
     }
   }
 }
}
window.onload=startList;
</script>
  <ul class="menu">
    <li>aaaaaa</li>
    <li>bbbbbb</li>
  </ul>
</body>
</html>