Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/07/2008, 12:15
elpulgas
 
Fecha de Ingreso: julio-2008
Mensajes: 6
Antigüedad: 15 años, 10 meses
Puntos: 0
Convertir celdas en links

Bueno, lo que quiero hacer es coger un link dentro de una tabla y hacer que toda la linea sea clickable. Para eso encontre un código que modifiqué un poco. Me funciona perfecto en FF pero no en IE. Este es el código:

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'");

          }
        }
      }
	  
}
Lamentablemente IE no soporta la funcion getElementsByClassName y el script no funciona asi como esta, porque hay hasta tres links en una misma tabla y no sabe cual es el que tiene prioridad. De antemano gracias por la ayuda .