Skip to content

Instantly share code, notes, and snippets.

Created May 5, 2016 21:11
Show Gist options
  • Save anonymous/c09e4a503327433ea87ba87c09302730 to your computer and use it in GitHub Desktop.
Save anonymous/c09e4a503327433ea87ba87c09302730 to your computer and use it in GitHub Desktop.
<script language="JavaScript">
function calculo(){
var total1=0, total2=0, total3=0, total4=0;
var total1 = parseFloat(total1);
var total2 = parseFloat(total2);
var total3 = parseFloat(total3);
var total4 = parseFloat(total4);
if (document.cel1.Locar1.checked== true){
total1 = 3999;
if (document.cel1.cel1d== "Dummy")
{
total1 = 3799.05;
}
else if (document.cel1.cel1n== "Normal")
{
total1 = 3599.1;
}
else if (document.cel1.cel1p== "Power")
{
total1 = 3199.2;
}
}
if (document.cel2.Locar2.checked== true){
total2 = total2 + 1199;
if (document.cel2.cel2d== "Dummy")
{
total2 = total2 * 0,95;
}
if (document.cel2.cel2n== "Normal")
{
total2 = total2 * 0,9;
}
if (document.cel2.cel2p== "Power")
{
total2 = total2 * 0,8;
}
}
if (document.cel3.Locar3.checked== true){
total3 = total3 + 1649;
if (document.cel3.cel3d== "Dummy")
{
total3 = total3 * 0,95;
}
if (document.cel3.cel3n== "Normal")
{
total3 = total3 * 0,9;
}
if (document.cel3.cel3p== "Power")
{
total3 = total3 * 0,8;
}
}
if (document.cel4.Locar4.checked== true){
total4 = total4 + 229;
if (document.cel4.cel4d== "Dummy")
{
total4 = total4 * 0,95;
}
if (document.cel4.cel4n== "Normal")
{
total4 = total4 * 0,9;
}
if (document.cel4.cel4p== "Power")
{
total4 = total4 * 0,8;
}
}
total = total1 + total2 + total3 + total4;
alert ("Total ate agora: " + total);
}
function formulario(){
var nome,cartao,numparcela, parcela;
var parc1 = parseFloat (document.tr2.op1);
var parc2 = parseFloat (document.tr2.op2);
var parc3 = parseFloat (document.tr2.op3);
var parc4 = parseFloat (document.tr2.op4);
var parc5 = parseFloat (document.tr2.op5);
if (document.tr2.nome.value== true && document.tr2.nome.value== true && document.tr2.op1.value== "1")
{
numparcela = 1;
parcela = total/1;
alert ("Prezado " + document.tr2.nome.value + ", seguem os dados da sua compra: ");
alert ("Total da compra: RS" + total);
alert ("Numero de parcelas: " + numparcela);
alert ("Valor de cada parcela: RS" + parcela);
}
else if (document.tr2.nome.value== true && document.tr2.nome.value== true && document.tr2.op2.value== "2")
{
numparcela = 2;
parcela = total/2;
alert ("Prezado " + document.tr2.nome.value + ", seguem os dados da sua compra: ");
alert ("Total da compra: RS" + total);
alert ("Numero de parcelas: " + numparcela);
alert ("Valor de cada parcela: RS" + parcela);
}
else if (document.tr2.nome.value== true && document.tr2.nome.value== true && document.tr2.op3.value== "3")
{
numparcela = 3;
parcela = total/3;
alert ("Prezado " + document.tr2.nome.value + ", seguem os dados da sua compra: ");
alert ("Total da compra: RS" + total);
alert ("Numero de parcelas: " + numparcela);
alert ("Valor de cada parcela: RS" + parcela);
}
else if (document.tr2.nome.value== true && document.tr2.nome.value== true && document.tr2.op4.value== "4")
{
numparcela = 4;
parcela = total/4;
alert ("Prezado " + document.tr2.nome.value + ", seguem os dados da sua compra: ");
alert ("Total da compra: RS" + total);
alert ("Numero de parcelas: " + numparcela);
alert ("Valor de cada parcela: RS" + parcela);
}
else if (document.tr2.nome.value== true && document.tr2.nome.value== true && document.tr2.op5.value== "5")
{
numparcela = 5;
parcela = total/5;
alert ("Prezado " + document.tr2.nome.value + ", seguem os dados da sua compra: ");
alert ("Total da compra: RS" + total);
alert ("Numero de parcelas: " + numparcela);
alert ("Valor de cada parcela: RS" + parcela);
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment