<!--#include file="inc_CharonCart.asp" --> <% ' ''Add shiping costs to cart ' CCcart_Shipping="0" %> <% ' ''Update cart contents ' CC_UpdateAction=Request.ServerVariables("SCRIPT_NAME") if Request("CC_UpdateCart") <> "" then for i=0 to ubound(CCcart,2) intProductID=CCcart(CC_UniqueKey,i) usa_size=trim(Request.Form("usa_size" & intProductID)) Quantity=trim(Request.Form("Qty" & intProductID)) isDelete=trim(Request.Form("Delete" & intProductID)) if Quantity = "" or Quantity="0" or isDelete <> "" then CCcart(CC_PRODUCTID,i)="" else if IsNumeric(Quantity) then CCcart(CC_QUANTITY,i)=Quantity CCcart(CC_Size,i)=usa_size end if end if next ' 'Code below to prevent Object Moved error in Netscape' ' CartToCookie CCcart,"CharonCart" if Session("UpdateNumber") <> "" then Session("UpdateNumber")=Session("UpdateNumber")+1 else Session("UpdateNumber")=1 end if response.redirect Request.ServerVariables("SCRIPT_NAME") & "?UpdateNumber=" & Session("UpdateNumber") end if %> <% ' ''Kill cart by setting cookie to nothing ' if Request("RemoveAll") <> "" then Response.Cookies("CharonCart")="" if "content.asp" <> "" then Response.Redirect "shopping.asp" end if %> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/JavaScript"> <!-- function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'"); } //--> </script> <table border="0" width="640" cellspacing="0" cellpadding="0" id="table1"> <tr> <td colspan="3"> </td> </tr> <tr> <td width="0"> </td> <td> <div align="center"> <table width="600" border="0" cellpadding="2" id="table2" style="font-size:12px"> <tr> <td height="100"><form action="<%=CC_UpdateAction%>" name="form" method="post"> <p align="center"> <strong>Products Cart</strong></p> <table width="100%" border="0" cellpadding="2" id="table3" style="font-size:12px"> <tr bgcolor="#e6e0d3"> <td width="33%" colspan="2"><div align="center"> <font size="2">Products</font></div></td> <td width="14%"><div align="center"> <font size="2">Unit Price</font></div></td> <td width="5%"><div align="center"> Qty</div></td> <td width="21%"><div align="center">Size</div></td> <td width="15%"><div align="center"> Sum</div></td> <td width="12%"><div align="center"> Del </div></td> </tr> <% ' 'Begin cart repeat region For i=0 to ubound(CCcart,2) if CCcart(CC_PRODUCTID,i) <> "" then %> <tr bgcolor="#FFFFCC"> <td bgcolor="#FFFBF2" width="10%"><a href="<%=CCcart(CC_ProductImg_view,i)%>" target="_blank"><img src="<%=CCcart(CC_ProductImg,i)%>" width="50" height="37" border="0"></a></td> <td bgcolor="#FFFBF2" width="23%"><%=CCcart(CC_Name,i)%></td> <td bgcolor="#FFFBF2"><div align="center">$<%=CCcart(CC_Price,i)%></div></td> <td bgcolor="#FFFBF2"><div align="center"> <font size="2"> <input name="<%="Qty" & CCcart(CC_UniqueKey,i)%>" type="text" id="quanity" value="<%=CCcart(CC_Quantity,i)%>" size="3"> </font></div></td> <td bgcolor="#FFFBF2"><div align="center"> <% dim rs Set rs = Server.CreateObject("ADODB.Recordset") rs.ActiveConnection = MM_connUsSys060910_STRING rs.Source = "select P_us_size,P_eur_Size from M_Merchandise WHERE P_ProductsID='" & replace(CCcart(CC_Name,i),"'","''") & "'" rs.CursorType = 0 rs.CursorLocation = 2 rs.LockType = 1 rs.Open() %> <div class="select2"> <select name="<%="usa_size" & CCcart(CC_UniqueKey,i)%>" id="<%="usa_size" & CCcart(CC_UniqueKey,i)%>"> <option value="-">select a size</option> <%do while not rs.eof if trim(rs("P_eur_Size"))<>"" and trim(rs("P_Us_Size"))<>"" then eur_sizeArr=split(rs("P_eur_Size"),",") us_sizeArr=split(rs("P_us_size"),",") split_char="," size_text="" sizevalue="" us_size="" eur_size="" For j=0 to ubound(eur_sizeArr) us_size="US:"&trim(US_sizeArr(j)) eur_size="EUR:"&trim(eur_sizeArr(j)) size_text="US:"&trim(US_sizeArr(j)) l=6-len(us_size) if l>0 then for k=0 to l-1 size_text=size_text+" " next end if size_text=size_text&split_char&" "&eur_size sizevalue=us_size&split_char&eur_size %> <option value="<%=size_value%>" <% if CCcart(CC_Size,i)=size_value then %> selected="selected" <%end if %> ><%=size_text%> </option> <% next elseif trim(rs("P_eur_Size"))<>"" then eur_sizeArr=split(rs("P_eur_Size"),",") For j=0 to ubound(eur_sizeArr) Size_text=trim(eur_sizeArr(j)) Sizevalue=trim(eur_sizeArr(j)) %> <option value="<%=size_value%>" <% if CCcart(CC_Size,i)=size_value then %> selected="selected" <%end if %> ><%=size_text%> </option> <% next elseif trim(rs("P_us_Size"))<>"" then For j=0 to ubound(us_sizeArr) Size_text=trim(us_sizeArr(j)) Sizevalue=trim(us_sizeArr(j)) %> <option value="<%=size_value%>" <% if CCcart(CC_Size,i)=size_value then %> selected="selected" <%end if %> ><%=size_text%> </option> <% next else end if rs.movenext loop rs.close set rs=nothing%> </select> </div> </div></td> <td bgcolor="#FFFBF2"><div align="center">$<%=CCcart_LineTotal%></div></td> <td bgcolor="#FFFBF2"><div align="center"> <font size="2"> <div class="checkboxBorder"> <input name="<%="Delete" & CCcart(CC_UniqueKey,i)%>" type="checkbox" id="delitem" style="position: relative; top: -4px!important; top:-3px;left:-5px!important; left:-3px;width:13px!important;width:15px; height:13px!important;height:15px;border:none;" value="checkbox"></div> </font></div></td> </tr> <% end if next ''end cart repeat region %> <tr> <td height="10" colspan="8"></td> </tr> <tr bgcolor="#FFCC99"> <td colspan="6"><div align="right"> <font size="2" color="#990000">Sum Total:</font></div></td> <td><div align="center">$<%=CCcart_GrandTotal%></div></td> </tr> </table> <table width="70%" height="50" border="0" align="center" id="table4"> <tr> <td width="35%"><div align="center"> <label> <input name="SM1" type="button" id="SM1" onClick="window.location='../index.asp';" value="Continue Shopping"> </label> </div></td> <td width="1%"></td> <td width="26%"><div align="center"> <label> <input name="SM2" type="submit" id="SM2" value="Update Order"> </label> </div></td> <td width="1%"></td> <td width="17%"><div align="center"> <label> <input name="SM3" type="button" id="SM3" onClick="MM_goToURL('parent','<%=Request.ServerVariables("SCRIPT_NAME")&"?RemoveAll=1"%>');return document.MM_returnValue" value="Cancel"> </label> </div></td> <td width="1%"></td> <td width="19%"><div align="center"> <label> <input name="SM4" type="button" id="SM4" onClick="MM_goToURL('parent','sendinfo.asp');return document.MM_returnValue" value="Check out"> </label> </div></td> </tr> </table> <table width="90%" border="0" align="center" cellpadding="2" cellspacing="2" id="table5" style="font-size:12px"> <tr> <td><font color="#FF0000"><strong>Note: After filling in "Quantity","Size" or "Del" box, Please click in "Update Order ".</strong></font></td> </tr> </table> <input type="hidden" name="CC_UpdateCart" value="1"> </form></td> </tr> </table> </div> </td> <td> </td> </tr> <tr> <td colspan="3"> </td> </tr> </table>
大家好啊,我是个新手菜鸟级的,所以如果问题幼稚,大家不要见笑啊~~上面是一段简单的购物车的代码段,当然不是我写的,呵呵……然后主要的问题是:以上HTML中有一个表单,然后有一个Update Order(更新订单)的提交按钮(Submit类型的),然后又一个Check Out(结账)的按钮(Button类型的),本来更新订单是用来操作用户购买的数量和尺寸的,然后我现在不想有这个操作,我想在用户进行结账的时候,通过Check Out这个Button类型的按钮进行更新订单(也就是提交表单),然后跳转到结账页面。简单的说我是想通过一个Button类型的按钮来实现表单内容的更新和页面的跳转操作。不知道哪位高手能够给予些指点啊~~我在这里感谢大家了~呵呵……上面的代码运行出来的效果图如附件中所示~~就是不想要Update Order按钮,然后用Check Out 按钮实现它的功能~~