欢迎光临
我们一直在努力

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

建站超值云服务器,限时71元/月

三、订单修改页面: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>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 我用JS+Cookie编写的购物车,(添加、修改过程在客户端执行,一次提交服务器,IE适用),请大家指正(三)
分享到: 更多 (0)

相关推荐

  • 暂无文章