Tema: Presupuesto
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/06/2009, 06:14
Avatar de gjx2
gjx2
 
Fecha de Ingreso: agosto-2008
Ubicación: R.D
Mensajes: 1.153
Antigüedad: 15 años, 9 meses
Puntos: 139
Respuesta: Presupuesto

Puedes crear un codigo en javascript y luego enviar el resultado.
Aqui te pongo un codigo de ejemplo a ver si te funciona.


Código HTML:




<script>
function check(chk){
if(bk(chk).checked){
sumar(bk(chk).value);}
else{restar(bk(chk).value);}}
function bk(chk){
return document.getElementById(chk);
}
function sumar(chk){
var inputTotal = bk("Total").value;
inputTotal = (parseInt(inputTotal) + parseInt(chk));
bk("Total").value = inputTotal;
}
function restar(chk){
var inputTotal = bk("Total").value;
inputTotal = (parseInt(inputTotal) - parseInt(chk));
bk("Total").value = inputTotal;
}

</script>
<div>
<form>
<p>
<input type="checkbox" name="ch_1" id="ch_1" onClick="check(this.id);" value="100" >$.100<br>
<input type="checkbox" name="ch_1" id="ch_2" onClick="check(this.id);" value="200" >$.200<br>
<input type="checkbox" name="ch_1" id="ch_3" onClick="check(this.id);" value="400" >$.400<br>
</p>
<p><b>Total :</b><input type="text" id="Total" value="0"></p>
</form></div>





Si lo que quieres es llevarlo a otra pagina , puedes calcular el total con esta funcion , y luego crear algun boton para enviar el formulario a un archivo php , para posterior almacenamiento.