Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/08/2008, 11:02
elpulgas
 
Fecha de Ingreso: julio-2008
Mensajes: 6
Antigüedad: 16 años, 6 meses
Puntos: 0
Problemas con script en IE7

Bueno, tnego un script para cambiar el estilo de las celdas en una tabla cuando uno pasa el mouse por ella. El código es asi:

Código:
		if (navigator.userAgent.indexOf('MSIE') !=-1)
{ 
	window.onload=function(){
 ConvertRowsToLinks("table1");
	}
 function ConvertRowsToLinks(xTableId){
        var rows = document.getElementById(xTableId).getElementsByTagName("tr");
        for(i=0;i<rows.length;i++){
          var links = rows[i].getElementsByTagName("a");

          if(links.length == 1 && links.className == 'forumlink'){
            rows[i].onclick = new Function("document.location.href='" + links[0].href + "'");
            rows[i].onmouseover = new Function("this.className='highlight'");
            rows[i].onmouseout = new Function("this.className='row1'");
			rows[i].className = 'row1';
          }
        }
		
      }

}
else {
	window.onload=function(){
 Rowlink();
	}
function Rowlink(){
        var rows = document.getElementsByTagName("tr");
        for(i=0;i<rows.length;i++){
          var link = rows[i].getElementsByClassName("forumlink");
          if(link.length == 1){
			rows[i].className = 'row1';
            rows[i].onclick = new Function("document.location.href='" + link[0].href + "'");
            rows[i].onmouseover = new Function("this.className='highlight'");
            rows[i].onmouseout = new Function("this.className='row1'");

          }
        }
      }
	  
}
Ademas de cambiar el estilo, hace que cuando uno haga click en cualquier parte, lo lleve al link principal. El problema es que IE no tiene getElementsByClassName y no me funciona. Alguna idea?