购物车子页面代码(购物车web代码)
admin 发布:2022-12-19 22:05 146
本篇文章给大家谈谈购物车子页面代码,以及购物车web代码对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
- 1、ecshop 修改购物车中的购物数量,代码如下,为什么点击加减图片没有得到相应的效果呢?急。。。
- 2、ASP做一个简单的购物车
- 3、asp 购物车代码问题
- 4、用jsp和数据库做购物车,怎么能通过点击按钮把购买数量和商品信息传给购物车页面,急!!下面是部分代码
- 5、如何用html css javascript php制作购物车?
- 6、谁有简单点的asp购物车的代码呀?谢谢拉!
ecshop 修改购物车中的购物数量,代码如下,为什么点击加减图片没有得到相应的效果呢?急。。。
这样,我给你一段这个代码,你相对比一下看看
li style="width:608px" div class="guige" style="width:220px; float:left;"
script language="javascript" type="text/javascript" function goods_cut(){ var num_val=document.getElementById('number'); var new_num=num_val.value; var Num = parseInt(new_num); if(Num1)Num=Num-1; num_val.value=Num; } function goods_add(){ var num_val=document.getElementById('number'); var new_num=num_val.value; var Num = parseInt(new_num); Num=Num+1; num_val.value=Num; } /script
span class="shuliang" style="width:165px"购买数量:a href="javascript:void(0)" onclick="goods_cut();changePrice();"-/ainput onblur="changePrice();" id="number" name="" value="1" type="text"a href="javascript:void(0)" onclick="goods_add();changePrice();"+/a/span/div
div style="float:left; width:150px;" {$lang.amount}:strong id="ECS_GOODS_AMOUNT" style="font-size:16px; font-weight:bold; color:#F34761;"/strong/div
/li
ASP做一个简单的购物车
可以去中国站长站看看,里面的源代码很多的。不过我希望你在网上找一个一个简单的源代码,然后模仿着写一写,否则学不到东西啊。
asp 购物车代码问题
tdinput type="button" onclick="javascript:document.form1.action='update.asp?rowcount=%=i%pid=%=rs(1)%pcount=%=rs(3)%';document.form1.submit();"value="确认修改"/td
改为
tdinput type="button" onclick="javascript:document.form1.action='update.asp?id=%=rs("Id")%rowcount=%=i%';document.form1.submit();"value="确认修改"/td
%
'这里需要注意在上个页面,有个i值,在这里就用到了,你要指明修改的是哪一行记录
......
response.redirect("mycar.asp")'执行完之后重新跳转到mycar.asp
%
改为
%
'只需商品id和修改后的数量值
dim id
id=request.querystring("id")
pcount=request.querystring("pcount")
sql="update buy set pcount ='"pcount"' where Id="id
conn.execute sql
conn.close
set conn=nothing
response.redirect("mycar.asp")'执行完之后重新跳转到mycar.asp
%
用jsp和数据库做购物车,怎么能通过点击按钮把购买数量和商品信息传给购物车页面,急!!下面是部分代码
你把购买的数量和商品信息做成一个javabean,然后把这个javabean存在session里面,你点击按钮就向服务器端发出请求,然后服务器端处理请求后用jsp显示,这样就可以了呀
如何用html css javascript php制作购物车?
!DOCTYPE html
html
head
meta charset="utf-8"
title/title
link rel="stylesheet" href="---.css"
script src="---.js"/script
/head
body
div class="container"
div class="shop"
div class="header"
input type="checkbox" class="shop-checkbox"
span class="shop-icon"/span
span class="shop-name"---/span
span class="wangwang-icon"/span
/div
div class="items"
div class="item"
divinput class="item-checkbox" type="checkbox" name="" id=""/div
div
span class="item-img"/span
/div
div class="item-name"
div----/div
div class="promotion-icons"span/spanspan/spanspan/span/div
/div
div class="sku"---/div
div class="price"
div class="price-1"---/div
div class="price-2" data-price="---"----/div
/div
div class="num-control"
span class="num-minus"-/span
input class="num" type="text" value="1"
span class="num-plus"+/span
/div
div class="item-price-total"
span¥50.13/span
/div
div class="operation"
div---/div
div---/div
/div
/div
/div
/div
div class="shop"
div class="header"
input type="checkbox" class="shop-checkbox"
span class="shop-icon"/span
span class="shop-name"---/span
span class="wangwang-icon"/span
/div
div class="items"
div class="item"
divinput class="item-checkbox" type="checkbox" name="" id=""/div
div
span class="item-img"/span
/div
div class="item-name"
div----/div
div class="promotion-icons"span/spanspan/spanspan/span/div
/div
div class="sku"---/div
div class="price"
div class="price-1"---/div
div class="price-2" data-price="---"---/div
/div
div class="num-control"
span class="num-minus"-/span
input class="num" type="text" value="1"
span class="num-plus"+/span
/div
div class="item-price-total"
span¥9.90/span
/div
div class="operation"
div移入收藏夹/div
div删除/div
/div
/div
div class="item"
divinput class="item-checkbox" type="checkbox" name="" id=""/div
div
span class="item-img"/span
/div
div class="item-name"
div---/div
div class="promotion-icons"span/spanspan/spanspan/span/div
/div
div class="sku"---/div
div class="price"
div class="price-1"---/div
div class="price-2" data-price="---"---/div
/div
div class="num-control"
span class="num-minus"-/span
input class="num" type="text" value="1"
span class="num-plus"+/span
/div
div class="item-price-total"
span¥19.9/span
/div
div class="operation"
div移入收藏夹/div
div删除/div
/div
/div
/div
/body
/html
.container{
width: 1000px;
margin-left: auto;
margin-right: auto;
color: #444444;
}
.header{
margin: 8px;
}
.shop-icon, .wangwang-icon, .promotion-icons span{
display:inline-block;
width: 15px;
height: 15px;
background-color: rgb(117,192,241);
}
.promotion-icons span{
margin-right: 4px;
}
.items{
border: 1px solid #ebe9e9;
}
.item{
display: flex;
margin: 8px;
}
.item-img{
width:100px;
height: 100px;
display: inline-block;
background-color: aquamarine;
margin-left: 6px;
margin-right: 6px;
}
.item-name
{
display: flex;
flex-direction: column;
justify-content: space-between;
}
.sku, .price,.item-price-total,.operation,.num-control{
margin-left: 18px;
}
.num{
width: 18px;
height: 15px;
}
.num-control{
display: flex;
align-items: baseline;
}
.num-minus,.num-plus{
width: 18px;
height: 22px;
display: inline-block;
background-color: #ebe9e9;
}
.checkout{
display: flex;
justify-content: space-between;
}
.shop{
margin-bottom: 20px;
margin-top: 30px;
}
.goods,.freight,.checkout-button{
margin-left: 15px;
}
.price-1{
text-decoration: line-through;
color: gray;
}
.check-num ,.total-price{
font-size: large;
color: red;
margin-left: 3px;
margin-right: 3px;
}
.checkout-button{
height: 30px;
width: 50px;
background-color: beige;
}
.checkout{
margin-top: 15px;
}
.item-name{
width: 25%;
}
.item-price-total{
width: 5%;
}
.sku{
width: 20%;
}
function updatePrice(){
let items = document.querySelectorAll('.item');
let totalNum = 0;
let totalPrice = 0;
items.forEach(function(item){
if(item.querySelector('.item-checkbox').checked){
let num = item.querySelector('.num').value;
totalNum = totalNum + parseInt(num);
let price = item.querySelector('.price-2').getAttribute('data-price');
totalPrice = totalPrice + parseFloat(price) * num;
}
});
document.querySelector('.check-num').innerText= totalNum;
document.querySelector('.total-price').innerText = totalPrice;
}
window.onload=function(){
let itemCheckboxes = document.querySelectorAll('.item-checkbox');
itemCheckboxes.forEach(function(itemCheckbox){
itemCheckbox.onchange = function(){
updatePrice();
}
});
let minuses = document.querySelectorAll('.num-minus');
minuses.forEach(function(minus){
minus.onclick = function(event){
let num=minus.parentElement.querySelector('.num').value;
if(parseInt(num)1)
{
minus.parentElement.querySelector('.num').value=parseInt(num)-1;
updatePrice();
}
};
});
let pluses = document.querySelectorAll('.num-plus');
pluses.forEach(function(plus){
plus.onclick = function(event){
let num=plus.parentElement.querySelector('.num').value;
plus.parentElement.querySelector('.num').value=parseInt(num)+1;
updatePrice();
}
});
}
谁有简单点的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;iNUM.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
%
关于购物车子页面代码和购物车web代码的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;
相关推荐
- 05-17web网站设计,web网站设计教程
- 05-13web前端开发工程师,Web前端开发工程师是做什么的
- 05-09网页代码,网页代码快捷键
- 05-06单页网站的代码(完整的网页代码)[20240506更新]
- 05-06个人主页图片代码(个人主页图片代码怎么弄)[20240506更新]
- 05-06提取微信名片代码(微信名片信息提取)[20240506更新]
- 05-06php后台权限管理代码(php管理员权限)[20240506更新]
- 05-06付费观看代码php(付费观看代码)[20240506更新]
- 05-06在线html执行代码(html怎么运行)[20240506更新]
- 05-06源代码管理资源管理器(资源管理器运行代码)[20240506更新]
取消回复欢迎 你 发表评论:
- 标签列表
- 最近发表
- 友情链接