Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script>
- var total=0;
- function sumar(valor) {
- total += valor;
- document.formulario.total.value=total;
- }
- function restar(valor) {
- total-=valor;
- document.formulario.total.value=total;
- }
- </script>
- </head>
- <body>
- <form name_1=formulario1>
- <input name_1="checkbox" type="checkbox" onClick="if (this.checked) sumar(1); else restar(1)" value="checkbox">$1<br>
- <input name_1="checkbox" type="checkbox" onClick="if (this.checked) sumar(2); else restar(2)" value="checkbox">$2<br>
- <input type="text" name_1="total" value="0">
- </form>
- <form name=formulario2>
- <input name="checkbox" type="checkbox" onClick="if (this.checked) sumar(1); else restar(1)" value="checkbox">$1<br>
- <input name="checkbox" type="checkbox" onClick="if (this.checked) sumar(2); else restar(2)" value="checkbox">$2<br>
- <input type="text" name="total" value="0">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement