Front desk manager for shopping cart-only once with Server (ii)
Source: Internet
Author: User
Cart.js
Please save it as cart.js and put it in the same directory as the previous part of the HTML
//------------------------------------------------------------------------------
//
File Name:cart.js
//
Description: JavaScript function library for shopping cart foreground
//
function List:on_cancel (Txtamount, txtsum)----Cancel the item
On_update ()----Update quantity
On_del ()----Delete all
Updatedate ()----Update form display
Round ()----rounded to the specified number of decimal places
//
Aurthor:liuyunpeng
//
Date:2000/09/03
//
HISTORY:2000/09/03 version 1.0
//
//------------------------------------------------------------------------------
----------------code begin here------------------------------------------
function On_cancel (Txtamount, Txtsum)
{
Txtamount.value = 0;
Txtsum.value = 0;
UpdateData (); }
Update form Display
function UpdateData ()
{
var m_aamount = new Array ();
var m_aprice = new Array ();
var m_adiscount = new Array ();
var m_asum = new Array ();
var m_numtotal = 0;
var I, J, K, M;
i = 0;
j = 0;
k = 0;
m = 0;
Ask for quantity
for (i = 0; i < Document.frmorder. elements. length; i + +)
{
if (frmorder.elements [i].name.substring (0, 9) = = "Txtamount")
{
M_AAMOUNT[J] = frmorder.elements [I].value;
j + +;
}
if (frmorder.elements [i].name.substring (0) = = "Txtticketprice")
{
M_aprice[k] = Round (Frmorder.elements[i].value, 2);
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.