Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/11/2011, 02:41
asrael
 
Fecha de Ingreso: marzo-2010
Mensajes: 102
Antigüedad: 14 años, 1 mes
Puntos: 2
seleccionar los checkbo de una tabla

Buenas tengo 2 tablas en mi página en la que la primera columna son checkboxs, entonces lo que quisiera hacer es que en la cabecera de cada tabla hubiera un checkbox que si lo pulsas automáticamente active los checkbox de la misma tabla.

He conseguido activar todos los checkbox de la página pero eso no me sirve asi que haber si me puede ayudar.

Aqui pongo el código de como tengo estructurada la tabla con los datos en plano (aunque en la version real las filas de la tabla salen con PHP)

Código HTML:
Ver original
  1. <table width="780" height="20" border="1" class="tablaCabecera">
  2.         <thead>
  3.             <tr height="20" class="thCabecera">
  4.                 <th width="20" class="thCabecera">&nbsp;</th>
  5.                 <th width="190" class="thCabecera">Fecha emisi&oacute;n</th>
  6.                 <th width="190" class="thCabecera">Concepto</th>
  7.                 <th width="190" class="thCabecera">Tipo</th>
  8.                 <th width="190" class="thCabecera">Cantidad</th>
  9.             </tr>
  10.         </thead>
  11.         <tbody>
  12.         </tbody>
  13.         </table>
  14.         <form action="#" id="formularioPagos">
  15.     <div class="tablaContenido">
  16.         <table width="780" height="300" border="1" style="border:1px solid #000000;">
  17.         <tbody>
  18.             <tr class="trContenido">
  19.                 <th width="20"  class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  20.                 <th width="190" class="thContenido">15/12/2011</th>
  21.                 <th width="190" class="thContenido">4ª cuota de 2011</th>
  22.                 <th width="190" class="thContenido">Cuota</th>
  23.                 <th width="190" class="thContenido">50</th>
  24.             </tr>
  25.             <tr class="trContenido">
  26.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  27.                 <th class="thContenido">15/9/2011</th>
  28.                 <th class="thContenido">3ª cuota de 2011</th>
  29.                 <th class="thContenido">Cuota</th>
  30.                 <th class="thContenido">50</th>
  31.             </tr>
  32.             <tr class="trContenido">
  33.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  34.                 <th class="thContenido">15/6/2011</th>
  35.                 <th class="thContenido">2ª cuota de 2011</th>
  36.                 <th class="thContenido">Cuota</th>
  37.                 <th class="thContenido">50</th>
  38.             </tr>
  39.             <tr class="trContenido">
  40.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  41.                 <th class="thContenido">15/3/2011</th>
  42.                 <th class="thContenido">1ª cuota de 2011</th>
  43.                 <th class="thContenido">Cuota</th>
  44.                 <th class="thContenido">50</th>
  45.             </tr>
  46.             <tr class="trContenido">
  47.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  48.                 <th class="thContenido">15/12/2010</th>
  49.                 <th class="thContenido">4ª cuota de 2010</th>
  50.                 <th class="thContenido">Cuota</th>
  51.                 <th class="thContenido">50</th>
  52.             </tr>
  53.             <tr class="trContenido">
  54.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  55.                 <th class="thContenido">15/9/2010</th>
  56.                 <th class="thContenido">3ª cuota de 2010</th>
  57.                 <th class="thContenido">Cuota</th>
  58.                 <th class="thContenido">50</th>
  59.             </tr>
  60.              <tr class="trContenido">
  61.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  62.                 <th class="thContenido">15/6/2010</th>
  63.                 <th class="thContenido">2ª cuota de 2010</th>
  64.                 <th class="thContenido">Cuota</th>
  65.                 <th class="thContenido">50</th>
  66.             </tr>
  67.              <tr class="trContenido">
  68.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  69.                 <th class="thContenido">15/3/2010</th>
  70.                 <th class="thContenido">1ª cuota de 2010</th>
  71.                 <th class="thContenido">Cuota</th>
  72.                 <th class="thContenido">50</th>
  73.             </tr>
  74.         </tbody>
  75.     </table>   
  76.     </div> 
  77.  
  78. <table width="780" height="20" border="1" class="tablaCabecera">
  79.         <thead>
  80.             <tr height="20" class="thCabecera">
  81.                 <th width="20" class="thCabecera">&nbsp;</th>
  82.                 <th width="190" class="thCabecera">Fecha emisi&oacute;n</th>
  83.                 <th width="190" class="thCabecera">Concepto</th>
  84.                 <th width="190" class="thCabecera">Tipo</th>
  85.                 <th width="190" class="thCabecera">Cantidad</th>
  86.             </tr>
  87.         </thead>
  88.         <tbody>
  89.         </tbody>
  90.         </table>
  91.     <div class="tablaContenido">
  92.         <table width="780" height="300" border="1" style="border:1px solid #000000;">
  93.         <tbody>
  94.             <tr class="trContenido">
  95.                 <th width="20" valign="top" class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  96.                 <th width="190" class="thContenido">24/12/2011</th>
  97.                 <th width="190" class="thContenido">5 números del 2576392 de la lotería del niño</th>
  98.                 <th width="190" class="thContenido">Lotería</th>
  99.                 <th width="190" class="thContenido">200</th>
  100.             </tr>
  101.             <tr class="trContenido">
  102.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  103.                 <th class="thContenido">23/12/2011</th>
  104.                 <th class="thContenido">5 números del 0145236 de la lotería del niño</th>
  105.                 <th class="thContenido">Lotería</th>
  106.                 <th class="thContenido">200</th>
  107.             </tr>
  108.             <tr class="trContenido">
  109.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  110.                 <th class="thContenido">22/12/2011</th>
  111.                 <th class="thContenido">5 números del 0147896 de la lotería del niño</th>
  112.                 <th class="thContenido">Lotería</th>
  113.                 <th class="thContenido">200</th>
  114.             </tr>
  115.             <tr class="trContenido">
  116.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  117.                 <th class="thContenido">20/12/2011</th>
  118.                 <th class="thContenido">5 números del 0235478 de la lotería del niño</th>
  119.                 <th class="thContenido">Lotería</th>
  120.                 <th class="thContenido">200</th>
  121.             </tr>
  122.             <tr class="trContenido">
  123.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  124.                 <th class="thContenido">18/12/2011</th>
  125.                 <th class="thContenido">5 números del 1245784 de la lotería del niño</th>
  126.                 <th class="thContenido">Lotería</th>
  127.                 <th class="thContenido">200</th>
  128.             </tr>
  129.             <tr class="trContenido">
  130.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  131.                 <th class="thContenido">16/12/2011</th>
  132.                 <th class="thContenido">5 números del 1245688 de la lotería del niño</th>
  133.                 <th class="thContenido">Lotería</th>
  134.                 <th class="thContenido">200</th>
  135.             </tr>
  136.              <tr class="trContenido">
  137.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  138.                 <th class="thContenido">10/12/2011</th>
  139.                 <th class="thContenido">5 números del 2354788 de la lotería del niño</th>
  140.                 <th class="thContenido">Lotería</th>
  141.                 <th class="thContenido">200</th>
  142.             </tr>
  143.              <tr class="trContenido">
  144.                 <th class="thContenido"><input name="seleccionar" type="checkbox" value="" /></th>
  145.                 <th class="thContenido">02/12/2011</th>
  146.                 <th class="thContenido">5 números del 2354245 de la lotería del niño</th>
  147.                 <th class="thContenido">Lotería</th>
  148.                 <th class="thContenido">200</th>
  149.             </tr>
  150.         </tbody>
  151.     </table>   
  152.     </div> 
  153. </form>

Un saludo y gracias por su tiempo