Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/02/2011, 08:31
lea14_9
 
Fecha de Ingreso: febrero-2011
Mensajes: 12
Antigüedad: 13 años, 3 meses
Puntos: 0
Bordes de Tabla

Hola a todos. Estaba experimentando un poco con JavaScript y tablas HTML, e hice una tabla con un encabezado y luego, a las filas que hay debajo de éste, les agregué una llamada a una función JavaScript para que cuando se pase con el mouse sobre ellas se cambien de color los bordes izquierdo, derecho y el de abajo; y al salir de la fila vuelva a la normalidad. El problema es que sólo funciona bien en Firefox y no en Chrome ni en Explorer (en este caso pienso que es porque le aplico las funciones al tag <tr>). Los códigos son los siguientes:

HTML (tabla.htm):
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Tabla</title>
  5. <script src="subrayar.js" type="text/javascript"></script>
  6. </head>
  7. <table width="400" cellspacing="0" cellpadding="2" border="1" bordercolor="#CCCCCC" frame="box" rules="rows">
  8.   <tr height="26" align="center" valign="middle" bgcolor="#CCCCCC" style="border-bottom:#CCCCCC">
  9.     <th>Nombre</th>
  10.     <th>Edad</th>
  11.     <th>Peso</th>
  12.     <th>Altura</th>
  13.   </tr>
  14.   <tr height="28" align="center" valign="middle" onmouseover="subrayar_over(this)" onmouseout="subrayar_out(this)">
  15.     <td><strong>Juan</strong></td>
  16.     <td>44</td>
  17.     <td>82 Kg.</td>
  18.     <td>1.70 Mts.</td>
  19.   </tr>
  20.   <tr height="28" align="center" valign="middle" onmouseover="subrayar_over(this)" onmouseout="subrayar_out(this)">
  21.     <td><strong>Jos&eacute;</strong></td>
  22.     <td>39</td>
  23.     <td>77 Kg.</td>
  24.     <td>1.65 Mts.</td>
  25.   </tr>
  26.   <tr height="28" align="center" valign="middle" onmouseover="subrayar_over(this)" onmouseout="subrayar_out(this)">
  27.     <td><strong>Liliana</strong></td>
  28.     <td>58</td>
  29.     <td>80 Kg.</td>
  30.     <td>1.68 Mts.</td>
  31.   </tr>
  32.   <tr height="28" align="center" valign="middle" onmouseover="subrayar_over(this)" onmouseout="subrayar_out(this)">
  33.     <td><strong>Omar</strong></td>
  34.     <td>43</td>
  35.     <td>82Kg.</td>
  36.     <td>1.65 Mts.</td>
  37.   </tr>
  38.   <tr height="28" align="center" valign="middle" onmouseover="subrayar_over(this)" onmouseout="subrayar_out(this)">
  39.     <td><strong>Luis</strong></td>
  40.     <td>35</td>
  41.     <td>70 Kg.</td>
  42.     <td>1.60 Mts.</td>
  43.   </tr>
  44.   <tr height="28" align="center" valign="middle" onmouseover="subrayar_over(this)" onmouseout="subrayar_out(this)">
  45.     <td><strong>Felisa</strong></td>
  46.     <td>45</td>
  47.     <td>76 Kg.</td>
  48.     <td>158 Mts.</td>
  49.   </tr>
  50. </body>
  51. </html>

JavaScript (subrayar.js):
Código Javascript:
Ver original
  1. function subrayar_over(fila){
  2.   fila.style.borderBottom="solid 1px #09F";
  3.   fila.style.borderRight="solid 1px #09F";
  4.   fila.style.borderLeft="solid 1px #09F";
  5. }
  6. function subrayar_out(fila){
  7.   fila.style.borderBottom="solid 1px #CCC";
  8.   fila.style.borderRight="solid 1px #CCC";
  9.   fila.style.borderLeft="solid 1px #CCC";
  10. }

Bueno si alguien me puede dar una mano se lo agradezco. Saludos.