Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

gibertomelo

Formulario com soma e descontos, pequeno problema!!

Recommended Posts

bem..

 

quando eu seleciono os 3 itens, ele fica em R$119.70

 

porem, quando eu deseleciono 1 item, era pra ele voltar o valor para R$84.80, e isso nao esta acontecendo.

 

alguem pode me dar uma dica do que possa ser?? creio que seja algo bem simples, mas já fucei fucei e nada..

 

se alguem tiver alguma solução agradeço

 

<html><head><title>form</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css"><!--td, p, body { font-family: Trebuchet MS, Tahoma, Arial; font-size: 12px; color:#333333; }a:link { color:#006699; text-decoration: none; font-weight: bold; font-size: 13px }a:visited { color:#006699; text-decoration: none; font-weight: bold; font-size: 13px }a:hover { color:#999999; text-decoration: underline; font-weight: bold; font-size: 13px }--></style></head><script LANGUAGE="JavaScript"><!--function checkChoice(whichbox) {with (whichbox.form) {if (whichbox.checked == false) {if (hiddentotal.value == 49.90) { hiddentotal.value = eval(hiddentotal.value) - 49.90; }if (hiddentotal.value == 84.80) { hiddentotal.value = eval(hiddentotal.value) - 34.90; }if (hiddentotal.value == 119.70) { hiddentotal.value = eval(hiddentotal.value) - 34.90; }}else {if (hiddentotal.value == 0.00) { hiddentotal.value = eval(hiddentotal.value) + 49.90; } else if ((hiddentotal.value == 49.90) || (hiddentotal.value == 84.80)) { hiddentotal.value = eval(hiddentotal.value) + 34.90; }}return(formatCurrency(hiddentotal.value));   }}function formatCurrency(num) {num = num.toString().replace(/\$|\,/g,'');if(isNaN(num)) num = "0";cents = Math.floor((num*100+0.5)%100);num = Math.floor((num*100+0.5)/100).toString();if(cents < 10) cents = "0" + cents;for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));return ("R$" + num + "." + cents);}// --></script><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><form name="formulario_contato">  <table width="260" border="0" align="center" cellpadding="3" cellspacing="0">	<tr bgcolor="#CCCCCC"> 	  <td width="340" height="1"></td>	</tr>	<tr> 	  <td> <table width="250" border="0" cellspacing="0" cellpadding="3">		  <tr> 			<td colspan="2"> <div align="right"> 				<input name="kit1" type="checkbox" id="kit13" value="49.90" onClick="this.form.total.value=checkChoice(this);">				<font size="2">Kit 1</font></div>			  <div align="right"> 				<input name="kit2" type="checkbox" id="kit23" value="49.90" onClick="this.form.total.value=checkChoice(this);">				<font size="2">Kit 2</font></div>			  <div align="right"> 				<input name="kit3" type="checkbox" id="kit33" value="49.90" onClick="this.form.total.value=checkChoice(this);">				<font size="2">Kit 3</font></div></td>			<td width="149"><div align="center"> 				<table style="border:dotted 1px #CCCCCC" width="110" align="center" cellpadding="10" cellspacing="0">				  <tr> 					<td align="center"><div align="center"><strong><font color="#FF3000" size="2">VALOR 						TOTAL</font><font color="#667586" size="2"><br>						</font></strong> 						<input type="text" name="total" value="" size="11" style="border:solid 1px #CCCCCC; font-family: Trebuchet MS, Verdana, Arial; font-size: 11px; background-color:#FFFFFF;" readonly>						<input type=hidden name=hiddentotal value=0>					  </div></td>				  </tr>				</table>			  </div></td>		  </tr>		</table></td>	</tr>  </table></form></body></html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.