⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shopcart.asp

📁 一个购物网站
💻 ASP
字号:
<% 
  sCartItemNums = Session("cartitemnumarray")
  nCartItemQtys = Session("cartitemqtyarray")
  nNumCartItems = uBound(sCartItemNums)
   sName=request.querystring("username")
   sMode = request.querystring("mode")

   select case request.form("cmdSubmit")
    case "Proceed to Checkout" 
      sMode = "checkout"
    case "继续购物"
      sMode = "continue"
   end select 

   if sMode = "add" then
     nThisItemIndex = 0
     
     sItemNo = uCase(request.querystring("itemno"))

     if nNumCartItems > 0 then
       for i = 1 to nNumCartItems
         if ucase(scartitemnums(i)) = sItemNo then
           nThisItemIndex = i
           exit for
         end if
       next
     end if
   end if
 
   if nThisItemIndex = 0 then 
      nThisItemIndex = nNumCartItems + 1
      ReDim Preserve sCartItemNums(nThisItemIndex)
  
      redim Preserve nCartItemQtys(nThisItemIndex)
      sCartItemNums(nThisItemIndex) = sItemNo
      nCartItemQtys(nThisItemIndex) = 1
    else
      nCartItemQtys(nThisItemIndex) = nCartItemQtys(nThisItemIndex) + 1
    end if

     Session("cartitemnumarray") = sCartItemNums
     Session("cartitemqtyarray") = nCartItemQtys
     nNumCartItems = uBound(sCartItemNums)

 if sMode = "continue" then
    for i = 1 to nNumCartItems
      nThisQty = int(request.form("txtItemQty" & i))
      nCartItemQtys(i) = nThisQty
    next
    session("cartitemnumarray") = sCartItemNums
    session("cartitemqtyarray") = nCartItemQtys
  end if
if smode = "continue"  then
    response.redirect("index.asp")
end if


%>

  

<html>

<head>
<title></title>
</head>

<body>

<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
<form action="" method="POST">  
<font color="#008000" size="-1">  
<br><br>  
</font>  
<table align="center" border="0" height="103">  
  <caption align=center><b><font size=+2 color=#996666>购物清单</font></b></caption>  
  <tr bgcolor="#FFCC99">  
    <th height="10" ><font color="#336666" size="-1" readonly>  
      数量</font>  
    <th height="10"  ><font color="#336666" size="-1">  
      商品标号</font>  
    <th height="10" width="200"><font color="#336666" size="-1">  
      商品名称</font>  
    <th height="10" ><font color="#336666" size="-1">  
      单价</font>  
	<th height="10" <font color="#336666" size="-1">  
      总价</font>  
        
  </tr>  
<font face="Verdana,Arial" color="#008000" size="-1">  
    
<%  
  cSubTotal = 0  
  nNumItems = 0  
  for i = 1 to nNumCartItems  
	Set Con = Server.CreateObject( "ADODB.Connection" )  
	Con.open "PROVIDER=SQLOLEDB;DATA SOURCE=210.34.136.243;UID=user37;PWD=;DATABASE=project0104"  
	Set rs = Server.CreateObject("ADODB.Recordset")  
	sSQL = "SELECT * FROM Confectionery WHERE cConfectioneryID = '"&sCartItemNums(i)&"'"  
        rs.open sSQL, con, 3  
%>   
  <tr bgcolor="#FFCC99">  
<%  
  sTemp = "<input type='Text' name='txtItemQty"&i&"' value='"&nCartItemQtys(i)&"' size='3'>"  
  nNumItems = nNumItems + nCartItemQtys(i)  
%>  
</font>  
    <td align="center" height="18">  
      <font color="#000000" size="3">  
      <% = sTemp %></font></td>  
    <td align="center" height="18">  
      <font color="#000000" size="3">  
      <% = rs("cConfectioneryID") %></font></td>  
    <td height="18"><font color="#000000" size="3">  
      <% = rs("vConfectioneryName") %></font></td>  
<font face="Verdana,Arial" color="#008000" size="-1">  
    
	<% cPrice = rs("mConfectioneryRate") %>  
</font>  
	<td align="center" height="18">  
      <font color="#000000" size="3">  
      <% = formatcurrency(cPrice) %></font></td>  
<font face="Verdana,Arial" color="#008000" size="-1">  
    
<%   
  cExtension = nCartItemQtys(i) * cPrice   
  cSubTotal = cSubTotal + cExtension  
 total=cSubTotal   
%>    
</font>    
    <td align="right" height="18">  
      <font color="#000000" size="3">  
      <% = formatcurrency(cExtension) %></font></td>  
  </tr>  
  
<font face="Verdana,Arial" color="#008000" size="-1">  
    
<% next %>  
  
  
  </font>  
</table>  
<table align=center>  
  <tr>  
    <td ><font size="3">  
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;       
    总金额:<font color="#ff0066" size="-1"><%=total%></font><font size="-1">RMB</font></font></td>      
         
  </tr>      
  </table><br>      
  <table align=center>      
  <td height="34">      
    <font color="#008000" size="-1"><input type="Submit" name="cmdSubmit" value="继续购物" onclick="history.back()">      
   <td height="34">      
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      
    <a href="CusInsert.asp?total=<%=total%>">去收银台</a><script language="vbscript">    
           
    </script>     
     
   </td>     
     
  </table>     

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -