Ver Mensaje Individual
  #3 (permalink)  
Antiguo 12/08/2011, 06:12
Avatar de ceSharp
ceSharp
 
Fecha de Ingreso: octubre-2008
Ubicación: Madrid
Mensajes: 495
Antigüedad: 15 años, 6 meses
Puntos: 66
Respuesta: Pasar checkbox paginacion

hola angel,
te paso un ejemplo para almacenar checks en una página y luego recuperarlos al volver:
Código Javascript:
Ver original
  1. <html xmlns="http://www.w3.org/1999/xhtml" >
  2. <head>
  3.     <title>Untitled Page</title>
  4. <script type="text/javascript">
  5. function guardar()
  6. {
  7.     document.getElementById('hd_check').value='';
  8.     var check = document.getElementsByTagName('input');
  9.     for(i=0;i<check.length;i++)
  10.     {
  11.         if(check[i].type=='checkbox')
  12.         {
  13.             if(check[i].checked)
  14.                 document.getElementById('hd_check').value += check[i].id + "#";
  15.         }
  16.     }
  17. }
  18. function cargar()
  19. {
  20.     var hd_check = document.getElementById('hd_check').value.split('#');
  21.     var check = document.getElementsByTagName('input');
  22.     for(i=0;i<check.length;i++)
  23.     {
  24.         if(check[i].type=='checkbox')
  25.         {
  26.             for(j=0;j<hd_check.length;j++)
  27.             {
  28.                 if(hd_check[j] == check[i].id)
  29.                     document.getElementById(check[i].id).checked;
  30.             }
  31.         }
  32.        
  33.     }
  34. }
  35. </script>
  36. </head>
  37. <body onload="cargar()">
  38.     <form id="form1" action="otra_pagina.html" method="post" >
  39.     <div>
  40.     <input type="checkbox" id="ch1"/>uno
  41.     <input type="checkbox" id="ch2"/>dos
  42.     <input type="checkbox" id="ch3"/>tres
  43.     <input type="checkbox" id="ch4"/>cuatro
  44.     <input type="submit" id="bt_sb" onclick="guardar()" value="otra_pagina" />
  45.     <input type="hidden" value="" id="hd_check" />
  46.     </div>
  47.     </form>
  48. </body>
  49. </html>

si te funciona no te resultará dificil adaptarlo a lo tuyo. ten en cuenta que trabaja con IDS, te lo digo porque hay gente que no los usa, y yo creo que no debería dejar de usarlos, jejejeje.

saludos.