»
EnglishFrenchVietnamese

Print - Simple Shopping Cart - JavaScriptBank.com

Full version: jsB@nk » Utility » Simple Shopping Cart
URL: https://www.javascriptbank.com/a-simple-shopping-cart.html

Simple Shopping Cart © JavaScriptBank.comThis will allow your visitors to choose from a list of priced items. The script will tally the items, add the tax and send the order to you.

Full version: jsB@nk » Utility » Simple Shopping Cart
URL: https://www.javascriptbank.com/a-simple-shopping-cart.html



JavaScript
<SCRIPT language=JavaScript><!-- hide contents from old browsers        var Cost, GST, PST, Grand_Total;function tally()        {        Cost = 0;        if (document.orderform.Item1.checked) { Cost = Cost + 26.15;    }        if (document.orderform.Item2.checked) { Cost = Cost + 26.10;    }        if (document.orderform.Item3.checked) { Cost = Cost + 26;               }        if (document.orderform.Item4.checked) { Cost = Cost + 26;               }        if (document.orderform.Item5.checked) { Cost = Cost + 26.44;    }        if (document.orderform.Item6.checked) { Cost = Cost + 26.01;    }        if (document.orderform.Item7.checked) { Cost = Cost + 26;               }        if (document.orderform.Item8.checked) { Cost = Cost + 26;               }       if (document.orderform.Item9.checked) {  Cost = Cost + 25;               }        GST = (Cost * 0.07);        PST = (Cost * 0.07);        Cost = dollar(Cost);        GST = dollar(GST);        PST = dollar(PST);        Grand_Total = parseFloat(Cost) + parseFloat(GST) + parseFloat(PST);        Grand_Total = dollar(Grand_Total);        document.orderform.Total.value = "$" + Cost;        document.orderform.GST.value = "$" + GST;        document.orderform.PST.value = "$" + PST;        document.orderform.GrandTotal.value = "$" + Grand_Total;        }function dollar (amount){        amount = parseInt(amount * 100);        amount = parseFloat(amount/100);        if (((amount) == Math.floor(amount)) && ((amount - Math.floor (amount)) == 0))        {                amount = amount + ".00"                return amount;        }        if ( ((amount * 10) - Math.floor(amount * 10)) == 0)        {                amount = amount + "0";                return amount;        }        if ( ((amount * 100) - Math.floor(amount * 100)) == 0)        {                amount = amount;                return amount;        }        return amount;}//--></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<FORM name=orderform action=mailto:me@mydomain.com method=post encType=text/plain ?><TABLE border=0>  <TBODY>  <TR>    <TD colSpan=4>      <P><INPUT onclick=tally() type=checkbox value=Item1_chosen name=Item1>       Item One ($26.15)       <P><INPUT onclick=tally() type=checkbox value=Item2_chosen name=Item2>       Item Two ($26.10)       <P><INPUT onclick=tally() type=checkbox value=Item3_chosen name=Item3>       Item Three ($26)       <P><INPUT onclick=tally() type=checkbox value=Item4_chosen name=Item4>       Item Four ($26)       <P><INPUT onclick=tally() type=checkbox value=Item5_chosen name=Item5>       Item Five ($26.44)       <P><INPUT onclick=tally() type=checkbox value=Item6_chosen name=Item6>       Item Six ($26.10)       <P><INPUT onclick=tally() type=checkbox value=Item7_chosen name=Item7>       Item Seven ($26)       <P><INPUT onclick=tally() type=checkbox value=Item8_chosen name=Item8>       Item Eight ($26)       <P><INPUT onclick=tally() type=checkbox value=Item9_chosen name=Item9>       Item Nine ($25) </P></TD></TR>  <TR>    <TD>Total <INPUT size=7 value=$0 name=Total></TD>    <TD>PST (7%) <INPUT size=6 value=$0 name=PST></TD>    <TD colSpan=2>GST (7%) <INPUT size=6 value=$0 name=GST></TD></TR>  <TR>    <TD>Grand Total <INPUT size=8 value=$0 name=GrandTotal></TD></TR>  <TR>    <TD>Company Name:</TD>    <TD colSpan=3><INPUT maxLength=40 size=35 name=Company></TD></TR>  <TR>    <TD>Contact Name:</TD>    <TD colSpan=3>First <INPUT maxLength=20 size=15 name=FirstName> Last       <INPUT maxLength=20 size=15 name=LastName></TD></TR>  <TR>    <TD>Address</TD>    <TD><INPUT maxLength=40 name=Street></TD></TR>  <TR>    <TD>City</TD>    <TD><INPUT maxLength=20 name=City> </TD>    <TD>Province/State:</TD>    <TD><INPUT maxLength=40 name=Province></TD></TR>  <TR>    <TD>Country:</TD>    <TD><INPUT maxLength=20 name=Country></TD>    <TD>Code:</TD>    <TD><INPUT maxLength=10 size=9 name=Code></TD></TR>  <TR>    <TD>Phone:</TD>    <TD><INPUT maxLength=5 size=3 name=Area> <INPUT maxLength=10 size=8       name=Phone></TD>    <TD>Fax:</TD>    <TD><INPUT maxLength=5 size=3 name=AreaFax> <INPUT maxLength=10 size=8       name=Fax></TD></TR>  <TR>    <TD>Email Address:</TD>    <TD colSpan=2><INPUT maxLength=30 size=30 name=Email></TD></TR>  <TR>    <TD colSpan=4 height=3>      <HR>    </TD></TR>  <TR>    <TD align=middle colSpan=2><INPUT type=submit value="Send Order"></TD>    <TD align=middle   colSpan=2><INPUT type=reset value="Reset Order"></TD></TR></TBODY></TABLE></FORM><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->