Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/02/2013, 10:45
Avatar de HackID1
HackID1
 
Fecha de Ingreso: febrero-2013
Ubicación: En Update
Mensajes: 492
Antigüedad: 11 años, 2 meses
Puntos: 17
Calcular checkbox y dar respuesta Ayudar Javascript

Tengo este código necesito que me muestre dependiendo de q Checkbox esten seleccionados unos permisos (los de LINUX) o otros

Tanto para propietario
como grupo y resto de usuarios..

Porfavor ayuda lo necesito en 2horas, solo tengo que modificar para que aparezca el numero en el total, asi,..

755 por ejemplo ... que eso seria

7 de Todos seleccionados en propietario
5 de Lectura y escritura en grupo
5 de lectura y escritura en resto

Ayuda por favor dejo el código.. y que sea facilito la modificación


Código Javascript:
Ver original
  1. <html>
  2. <head>
  3. <script>
  4. var total=0;
  5.  
  6. function sumar(valor) {
  7.     total += valor;
  8.     document.formulario.total.value=total;
  9.     }
  10.  
  11. function restar(valor) {
  12.     total-=valor;
  13.     document.formulario.total.value=total;
  14.     }
  15. </script>
  16. </head>
  17. <body align="center" bgColor="silver">
  18. <form name=formulario>
  19.  
  20. Por juan Pablo Montoya <br/>
  21. TOTAL ES: <input type="text" name="total" value="0">
  22. </form>
  23. Selecciona las opciones
  24. <table border="2px" align="center">
  25.             <tr>
  26.                 <td >Propietario</td>
  27.                 <td>
  28.                 <input name="checkbox" type="checkbox"
  29.                 onClick="if (this.checked) sumar(4); else restar(4)" value="checkbox"/>
  30.                     Lectura <br/>
  31.                    
  32.                 <input name="checkbox" type="checkbox"
  33.                 onClick="if (this.checked) sumar(2); else restar(2)" value="checkbox"/>
  34.                     Escritura <br/>
  35.                    
  36.                 <input name="checkbox" type="checkbox"
  37.                 onClick="if (this.checked) sumar(1); else restar(1)" value="checkbox"/>
  38.                     Ejecución</td>
  39.                
  40.             </tr>
  41.             <tr>
  42.                 <td>Grupo</td>
  43.                 <td>
  44.                 <input name="checkbox" type="checkbox"
  45.                 onClick="if (this.checked) sumar(4); else restar(4)" value="checkbox"/>
  46.                     Lectura <br/>
  47.                 <input name="checkbox" type="checkbox"
  48.                 onClick="if (this.checked) sumar(2); else restar(2)" value="checkbox"/>
  49.                     Escritura <br/>
  50.                 <input name="checkbox" type="checkbox"
  51.                 onClick="if (this.checked) sumar(1); else restar(1)" value="checkbox"/>
  52.                     Ejecución </td>
  53.             </tr>
  54.             <tr>
  55.                 <td>Resto</td>
  56.                 <td>
  57.                 <input name="checkbox" type="checkbox"
  58.                 onClick="if (this.checked) sumar(4); else restar(4)" value="checkbox"/>
  59.                 Lectura <br/>
  60.                 <input name="checkbox" type="checkbox"
  61.                 onClick="if (this.checked) sumar(2); else restar(2)" value="checkbox"/>
  62.                 Escritura <br/>
  63.                 <input name="checkbox" type="checkbox"
  64.                 onClick="if (this.checked) sumar(1); else restar(1)" value="checkbox"/>
  65.                 Ejecución</td>    
  66.             </tr>
  67.         </table>
  68.    
  69.  
  70. </body>
  71. </html>

Gracias por favor responder q tengo solo 2 horas
__________________
Puntuar +1 es buena forma de dar las gracias. :P
Your Time is limited, so don't waste it living someone else´s life.
Por: HackID1