谁有简单点的asp购物车的代码呀?谢谢拉!
展开全部
<%@ LANGUAGE="VBSCRIPT" %>
<!--#include file="util.asp" -->
<!--#include file="conn.asp" -->
<%
ProductList = Session("ProductList")
Products = Split(Request("cpbm"), ", ")
For I=0 To UBound(Products)
PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList
Head="以下是您所选购的物品清单"
ProductList = Session("ProductList")
If Len(ProductList) =0 Then
Response.Redirect "nothing.asp"
response.end
end if
If Request("MySelf") = "Yes" Then
ProductList = ""
Products = Split(Request("cpbm"), ", ")
For I=0 To UBound(Products)
PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList
End If
If Len(ProductList) = 0 Then
Response.Redirect "nothing.asp"
response.end
end if
set rs=server.createobject("adodb.recordset")
sql = "Select * From Product"
sql = sql & " Where Product_Id In (" & ProductList & ")"
rs.open sql,conn,3,3
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>以下是您所选购的物品清单</title>
<href="style.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<script language="Javascript">
//函数名:fucCheckNUM
//功能介绍:检查是否为数字
//参数说明:要检查的数字
//返回值:1为是数字,0为不是数字
function fucCheckNUM(NUM)
{
var i,j,strTemp;
strTemp="0123456789";
if ( NUM.length== 0)
return 0
for (i=0;i<NUM.length;i++)
{
j=strTemp.indexOf(NUM.charAt(i));
if (j==-1)
{
//说明有字符不是数字
return 0;
}
}
//说明是数字
return 1;
}
function clean()
{
window.location.href="clear.asp"
}
</script>
<SCRIPT language=javascript id=clientEventHandlersJS>
<!--
function form1_onsubmit()
{
newprice="Q_" & rs("Product_Id")
if ((fucCheckNUM(document.FORM1.newprice.value)==0) )
{ alert ("会员价有非法字符,请填写正确会员价。");
document.FORM1.newprice.focus();
return false;
}
//-->
}
</SCRIPT>
<body topmargin="5">
<center>
<div align="center">
<center>
<table width="80%" border="0" cellspacing="0">
<tr>
<td width="80%" valign="top"><p align="center">
</p>
<p align="center">
<font color="#FF0000" ><%=Head%></font></p>
<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript"><!--
function FrontPage_Form1_Validator(theForm)
{
var checkOK = "0123456789-";
var checkStr = theForm.<%="Q_" & rs("Product_Id")%>.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
allNum += ch;
}
if (!allValid)
{
alert("在 请输入正确的商品数量! 域中,只能输入 数字 个字符。");
theForm.<%="Q_" & rs("Product_Id")%>.focus();
return (false);
}
return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan --><form Action="eshop.asp" Method="POST" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1">
<input type="hidden" name="MySelf" value="Yes">
<div align="center"><center>
<table border="0" cellspacing="1" width="550" class=main bgcolor="#000000">
<tr bgcolor="#006699">
<td align="center" width="82" height="22" bgcolor="#006699"><font color="#EEEEEE">商品编号</font></td>
<td align="center" width="170" height="22" bgcolor="#006699"><font color="#EEEEEE">商品名称</font></td>
<td align="center" width="76" height="22" bgcolor="#006699"><font color="#EEEEEE">商品价格</font></td>
<td align="center" width="76" height="22" bgcolor="#006699"><font color="#EEEEEE">商品数量</font></td>
<td align="center" width="60" height="22" bgcolor="#006699"><font color="#EEEEEE">购买</font></td>
<td align="center" width="72" height="22" bgcolor="#006699"><font color="#EEEEEE">总价</font></td>
</tr>
<%
Sum = 0
While Not rs.EOF
Quatity = CInt( Request( "Q_" & rs("Product_Id")) )
If Quatity <= 0 Then
Quatity = CInt( Session(rs("Product_Id")) )
If Quatity <= 0 Then Quatity = 1
End If
Session(rs("Product_Id")) = Quatity
Sum = Sum + ccur(rs("P_NewPrice")) * Quatity
%>
<tr>
<td align="center" width="82" bgcolor="#EEEEEE"><%=rs("Product_ID")%>
</td>
<td align="center" width="170" bgcolor="#EEEEEE"><%=rs("Product_Name")%>
</td>
<td align="center" width="76" bgcolor="#EEEEEE"><%=rs("P_NewPrice")%>
</td>
<td align="center" width="76" bgcolor="#EEEEEE"><!--webbot
bot="Validation" S-Display-Name="请输入正确的商品数量!"
S-Data-Type="Integer" S-Number-Separators="x" --><input Name="<%="Q_" & rs("Product_Id")%>" Value="<%=Quatity%>" Size="3"></td>
<td Align="center" width="60" bgcolor="#EEEEEE"><input Type="CheckBox" Name="cpbm" Value="<%=rs("Product_Id")%>" Checked>
</td>
<td Align="center" width="72" bgcolor="#EEEEEE"><%=ccur(rs("P_NewPrice"))*Quatity%>.00元
</td>
</tr>
<%
rs.MoveNext
Wend
%>
<!--#include file="util.asp" -->
<!--#include file="conn.asp" -->
<%
ProductList = Session("ProductList")
Products = Split(Request("cpbm"), ", ")
For I=0 To UBound(Products)
PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList
Head="以下是您所选购的物品清单"
ProductList = Session("ProductList")
If Len(ProductList) =0 Then
Response.Redirect "nothing.asp"
response.end
end if
If Request("MySelf") = "Yes" Then
ProductList = ""
Products = Split(Request("cpbm"), ", ")
For I=0 To UBound(Products)
PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList
End If
If Len(ProductList) = 0 Then
Response.Redirect "nothing.asp"
response.end
end if
set rs=server.createobject("adodb.recordset")
sql = "Select * From Product"
sql = sql & " Where Product_Id In (" & ProductList & ")"
rs.open sql,conn,3,3
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>以下是您所选购的物品清单</title>
<href="style.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<script language="Javascript">
//函数名:fucCheckNUM
//功能介绍:检查是否为数字
//参数说明:要检查的数字
//返回值:1为是数字,0为不是数字
function fucCheckNUM(NUM)
{
var i,j,strTemp;
strTemp="0123456789";
if ( NUM.length== 0)
return 0
for (i=0;i<NUM.length;i++)
{
j=strTemp.indexOf(NUM.charAt(i));
if (j==-1)
{
//说明有字符不是数字
return 0;
}
}
//说明是数字
return 1;
}
function clean()
{
window.location.href="clear.asp"
}
</script>
<SCRIPT language=javascript id=clientEventHandlersJS>
<!--
function form1_onsubmit()
{
newprice="Q_" & rs("Product_Id")
if ((fucCheckNUM(document.FORM1.newprice.value)==0) )
{ alert ("会员价有非法字符,请填写正确会员价。");
document.FORM1.newprice.focus();
return false;
}
//-->
}
</SCRIPT>
<body topmargin="5">
<center>
<div align="center">
<center>
<table width="80%" border="0" cellspacing="0">
<tr>
<td width="80%" valign="top"><p align="center">
</p>
<p align="center">
<font color="#FF0000" ><%=Head%></font></p>
<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript"><!--
function FrontPage_Form1_Validator(theForm)
{
var checkOK = "0123456789-";
var checkStr = theForm.<%="Q_" & rs("Product_Id")%>.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
allNum += ch;
}
if (!allValid)
{
alert("在 请输入正确的商品数量! 域中,只能输入 数字 个字符。");
theForm.<%="Q_" & rs("Product_Id")%>.focus();
return (false);
}
return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan --><form Action="eshop.asp" Method="POST" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1">
<input type="hidden" name="MySelf" value="Yes">
<div align="center"><center>
<table border="0" cellspacing="1" width="550" class=main bgcolor="#000000">
<tr bgcolor="#006699">
<td align="center" width="82" height="22" bgcolor="#006699"><font color="#EEEEEE">商品编号</font></td>
<td align="center" width="170" height="22" bgcolor="#006699"><font color="#EEEEEE">商品名称</font></td>
<td align="center" width="76" height="22" bgcolor="#006699"><font color="#EEEEEE">商品价格</font></td>
<td align="center" width="76" height="22" bgcolor="#006699"><font color="#EEEEEE">商品数量</font></td>
<td align="center" width="60" height="22" bgcolor="#006699"><font color="#EEEEEE">购买</font></td>
<td align="center" width="72" height="22" bgcolor="#006699"><font color="#EEEEEE">总价</font></td>
</tr>
<%
Sum = 0
While Not rs.EOF
Quatity = CInt( Request( "Q_" & rs("Product_Id")) )
If Quatity <= 0 Then
Quatity = CInt( Session(rs("Product_Id")) )
If Quatity <= 0 Then Quatity = 1
End If
Session(rs("Product_Id")) = Quatity
Sum = Sum + ccur(rs("P_NewPrice")) * Quatity
%>
<tr>
<td align="center" width="82" bgcolor="#EEEEEE"><%=rs("Product_ID")%>
</td>
<td align="center" width="170" bgcolor="#EEEEEE"><%=rs("Product_Name")%>
</td>
<td align="center" width="76" bgcolor="#EEEEEE"><%=rs("P_NewPrice")%>
</td>
<td align="center" width="76" bgcolor="#EEEEEE"><!--webbot
bot="Validation" S-Display-Name="请输入正确的商品数量!"
S-Data-Type="Integer" S-Number-Separators="x" --><input Name="<%="Q_" & rs("Product_Id")%>" Value="<%=Quatity%>" Size="3"></td>
<td Align="center" width="60" bgcolor="#EEEEEE"><input Type="CheckBox" Name="cpbm" Value="<%=rs("Product_Id")%>" Checked>
</td>
<td Align="center" width="72" bgcolor="#EEEEEE"><%=ccur(rs("P_NewPrice"))*Quatity%>.00元
</td>
</tr>
<%
rs.MoveNext
Wend
%>
展开全部
上网搜索一下,比在这里问要快得多,在百度随便输入“购物车”代码
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
要学习我有刚调试成功的asp.net的代码(c#)
,给我在百度发信息,如只要使用现成的,建议用极品电子商城,功能、界面还不错!
,给我在百度发信息,如只要使用现成的,建议用极品电子商城,功能、界面还不错!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询