Caminho de Navegação Outros / Scripts / Produto Valor

Outros

 

Nenhuma avalição
Indique ao Ueba Indique ao BlogBlogs Indique ao Delicious Indique ao Technorati Indique ao Google Bookmarks Indique ao Newsgator
TAGS

Nenhuma tag foi definida ainda!

Defina as tags para esta página preenchendo o campo abaixo.

  • Máximo de 100 tags
  • Cada tag deve ter até 20 caracteres.
  • Separar as tags com virgula. Ex.: php, sql, html, xml, fireworks
COMENTAR

INDICAR
Nome do amigo: E-mail do amigo: Comentário:
REPORTAR ERRO Descreva o erro:

Produto ValorPostada em: 07/11/2009

Script Master
Por: Script Master Nº de Visualizações: 73.

Demonstração do script

Código fonte do script

<html>
<body>


<head>

<SCRIPT LANGUAGE="JavaScript">
<!--
function checkChoice(whichbox) {
with (whichbox.form) {
if (whichbox.checked == false)
hiddentotal.value = eval(hiddentotal.value) - eval(whichbox.value);
else
hiddentotal.value = eval(hiddentotal.value) + eval(whichbox.value);
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>
</head>
<body>

<center>
<table>
<tr>
<td>
<form name=myform>
<pre>
<font face=verdana size=1>COMPRAS
DISCO   R$ 10,00     <input type=checkbox name=Steak value="10.00" onClick="this.form.total.value=checkChoice(this);">
CD  R$ 20,00            <input type=checkbox name=Chicken value="20.00" onClick="this.form.total.value=checkChoice(this);">
TECLADO    R$ 30,00  <input type=checkbox name=Sushi value="30.00" onClick="this.form.total.value=checkChoice(this);">
<br>
Total: <input type="text" name="total" value="" size=6 readonly><input type=hidden name=hiddentotal value=0>
</pre>
</form>


</td>
</tr>
</table>
</center>



</body>
</html>