我用JS+Cookie编写的购物车,(添加、修改过程在客户端执行,一次提交服务器,IE适用)

三、订单修改页面:orderform.htm

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT LANGUAGE = "JavaScript" src="orderform_functions.js"></SCRIPT>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="673" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td width="673">
      <form name="OrderForm" method="post" action="">
        <input type="hidden" name="hiddenField" id="storage" size="10">
        
        <table width="85%" border="0" cellspacing="1" cellpadding="0" align="center">
          <tr bgcolor="#000099">
            <td width="46%">
              <div align="center"><font color="#FFFFFF">品名</font></div>
            </td>
            <td width="14%">
              <div align="center"><font color="#FFFFFF">售价</font></div>
            </td>
            <td width="12%">
              <div align="center"><font color="#FFFFFF">数量</font></div>
            </td>
            <td width="20%">
              <div align="center"><font color="#FFFFFF">价格小计</font></div>
            </td>
            <td width="8%"><font color="#FFFFFF"></font></td>
          </tr>
        </table>
<SCRIPT LANGUAGE = "JavaScript">
var the_list =unescape(ReadOrderForm('24_OrderForm'));
document.write(the_list);
if (the_list=='false'||the_list.indexOf("|")==-1)
{
    var totals=0
    document.write("您还没有选购任何商品!")
}
else
{
    document.OrderForm.storage.value=the_list;
    var totals;
    var broken_list = the_list.split("|");
    //<-
    for (i=1;i<broken_list.length;i++)
    {
        var single_list=broken_list[i];
        var broken_single_list = single_list.split("&");
        var subtotals=broken_single_list[2]*(broken_single_list[3]*100)/100;
        //note:broken_single_list[0]=item;
        //note:broken_single_list[1]=name;
        //note:broken_single_list[2]=amount;
        //note:broken_single_list[3]=price;
        
        //<--
        if (totals==null)
        {
            totals=subtotals;
        }
        else
        {
            totals=totals*100+subtotals*100;
            totals=totals/100;
        }
        //-->
        document.write("<table id='Table"+broken_single_list[0]+"' width='85%' border='0' cellspacing='1' cellpadding='0' align='center'>")
        document.write("<tr bgcolor='#CCCCCC'>");
        document.write("<td width='46%'>"+broken_single_list[1]+"</td>");
        document.write("<td width='14%'>"+broken_single_list[3]+"</td>");
        document.write("<td width='12%'>"+" <input id='aid"+broken_single_list[0]+"' type='text' name='textfield' value="+broken_single_list[2]+" size='5' maxlength='5' disabled onKeyUp=updateSubTotal('"+broken_single_list[0]+"',this.value,'"+broken_single_list[3]+"') onBlur=updateStorage('"+broken_single_list[0]+"',this.value)>"+"</td>");
        document.write("<td width='20%'><input type='text' size='10' id='id"+broken_single_list[0]+"'  style='BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BACKGROUND-COLOR:#CCCCCC'  readonly value="+subtotals+"></td>");
        document.write("<td width='8%'><input type='button' name='Submit' value='删除' disabled onClick=Delete(Table"+broken_single_list[0]+",'"+broken_single_list[0]+"')></td>");
        document.write("</tr>");
        document.write("</table>");
        
    }
    //->

    //if (totals==null)
    //{totals=0;}
}
</SCRIPT>
        <table width="85%" border="0" cellspacing="0" cellpadding="0" align="center">
          <tr bgcolor="#000099">
            <td width="92%">
              <div align="right"><font color="#FFFFFF">价格总计:</font></div>
            </td>
            <td width="8%"> <font color="#FFFFFF">
              <input type="text" id="total" name="textfield" size="10" readonly style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BACKGROUND-COLOR:000099; COLOR:FFFFFF" >
              </font></td>
          </tr>
        </table>
<script language="JavaScript">
document.OrderForm.total.value=totals;
</script>
        <div align="center">
          <p><br>
            <input type="button" id="update" name="Button" value="修改订单" onClick="updateCookie()">
            <input type="button" id="submit" name="Button" value="提交订单">
          </p>
          <p>  </p>
        </div>
      </form>
    </td>
  </tr>
</table>
</body>
</html>
300*300
 文章首页关于迷茫时代关于我写意人生
版权所有:迷茫时代 All rights reserved   
执行时间:0.00537 秒