Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/08/2009, 12:33
Avatar de Adler
Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 17 años, 4 meses
Puntos: 126
Respuesta: Este script no funciona un firefox

Hola

Hace poco monté esto que quizás te sea útil. Funciona en IE, FF, Opera y Chrome

Código javascript:
Ver original
  1. <html>
  2. <head>
  3. <style type="text/css">
  4. #tabla td {background-color:#FFFFFF;}
  5. </style>
  6. <script type="text/javascript">
  7. window.onload = function () {
  8. var elementos = document.getElementById("tabla").getElementsByTagName("td");
  9.     for (var i=0;i < elementos.length; i++)  {
  10.        
  11.         elementos[i].onclick = Celda;
  12.         elementos[i].onmouseover = Celda;
  13.         elementos[i].onmouseout = Celda;
  14.            
  15.          }
  16.  
  17. }
  18.  
  19. function Celda(evento) {
  20. var evento = evento || window.event;
  21.       switch(evento.type) {
  22. case 'mouseover':
  23.     //this.style.backgroundColor = ((this.style.backgroundColor == '#ff0000') || (this.style.backgroundColor == 'rgb(255, 0, 0)'))   ? '#FFFF00' : '#CCFF66' ;
  24. //alert(this.style.backgroundColor);
  25.     break;
  26.  
  27.  
  28. case 'mouseout':
  29.     this.style.backgroundColor = ((this.style.backgroundColor == '#ccffcc') || (this.style.backgroundColor == 'rgb(204, 255, 102)')) ? '#FFFFFF' : '#FF0000';
  30. //alert(this.style.backgroundColor);
  31.     break;
  32.  
  33.  
  34. case 'click':
  35.     this.style.backgroundColor = ((this.style.backgroundColor ==  '#ccffcc') || (this.style.backgroundColor == 'rgb(204, 255, 102)')) ? '#FF0000' : '#CCFF66';
  36. //alert(this.style.backgroundColor);
  37.     break;
  38.   }
  39. }
  40.  
  41.  
  42. </script>
  43. </head>
  44. <body>
  45. <table border="1" id="tabla">
  46. <tr>
  47. <td>celda1</td>
  48. <td>celda2</td>
  49. <td>celda3</td>
  50. <td>celda4</td>
  51. <td>celda5</td>
  52. <td>celda6</td>
  53. <td>celda7</td>
  54. </tr>
  55. </table>
  56. </body>
  57. </html>

Suerte
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />