Ver Mensaje Individual
  #4 (permalink)  
Antiguo 23/11/2012, 19:08
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 7 meses
Puntos: 10
Respuesta: Iluminar y marcar celda al pasar con el raton en una tabla.

@gebremswar, no me sale. He puesto esto y no se si puede ser por el contenido dinámico:
Código Javascript:
Ver original
  1. <script>
  2. $(document).on('ready', function(){
  3. * * $('#list .row').on({
  4. * * * * click: function(){
  5. * * * * * * var $checkbox = $(this).find('.check');
  6. * * * * * * if ($checkbox.prop('checked')) {
  7. * * * * * * * * $checkbox.prop('checked', false);
  8. * * * * * * * * $(this).removeClass('selected')
  9. * * * * * * } else {
  10. * * * * * * * * $checkbox.prop('checked', true);
  11. * * * * * * * * $(this).addClass('selected')
  12. * * * * * * }
  13. * * * * },
  14. * * * * mouseenter: function(){$(this).addClass('over')},
  15. * * * * mouseleave: function(){$(this).removeClass('over')}
  16. * * });
  17. * * $('#list .row .check').on('click', function(event){
  18. * * * * event.stopPropagation();
  19. * * * * $(this).parents('.row').toggleClass('selected');
  20. * * });
  21. });
  22. </script>
  23. <style>
  24. th, td {cursor:default}
  25. .row {
  26.     color: #000;
  27.     font-size: 10px;
  28. }
  29. .row.over {background-color:#E7E7E7}
  30. .row.selected {background-color:#0072C6;color:white}
  31. </style>
Código Javascript:
Ver original
  1. <table width="100%" id="list"  border="1" class="table-dg-grid" >
  2. <thead>
  3. <tr bgcolor=#9CF id=t70 ondblclick='coloreaf(70,1)' onMouseOver='coloreamosin(70,1)' onMouseOut='coloreamosout(70,1)'>
  4. <th><span title="selecc">Selecc.</span></th>
  5. <th><span title="num_aparato">NºAparato</span></th>
  6. <th><span title="aparato">Aparato</span></th>
  7. <th><span title="marca">Marca</span></th>
  8. <th><span title="modelo">Modelo</span></th>
  9. <th><span title="num_serie">NºSerie</span></th>
  10. <th><span title="num_producto">Cod/12nc</span></th>
  11. </tr>
  12.  </thead>
  13. <?php do { ?>
  14. <tr class="row">   
  15. <th><input name="s" type="checkbox" class="check" value="<?=$row_ap_usuarios['NUM_APARATO'];?>"/></th> 
  16. <th><?php echo $row_ap_usuarios['NUM_APARATO']; ?></th>
  17. <th><?php echo $row_ap_usuarios['APARATO']; ?></th>
  18. <th><?php echo $row_ap_usuarios['MARCA']; ?></th>  
  19. <th><?php echo $row_ap_usuarios['MODELO']; ?></th>
  20. <th><?php echo $row_ap_usuarios['NUM_SERIE']; ?></th>
  21. <th><?php echo $row_ap_usuarios['NUM_PRODUCTO']; ?></th>       
  22. </tr>
  23. <?php } while ($row_ap_usuarios = mysql_fetch_assoc($ap_usuarios)); ?>
  24. <caption class="tb1CaptionBottom"></caption>
  25. </table>

Gracias