<link href="common.css" rel="stylesheet" type="text/css" />
ecshop自带的样式代码为:<link href="{$ecs_css_path}" rel="stylesheet" type="text/css" />
在style.css里添加下面样式
.goods_cut {
background: url("../images/plus.gif") no-repeat scroll 0 0 transparent
border: 0 none
cursor: pointer
display: block
float: left
font-size: 0
height: 15px
line-height: 0margin: 8px 3px 0
width: 15px
}
input.goodsBuyBox, input.number {
border: 1px solid #DDDDDD
float: left
font-size: 10px
height: 18px
line-height: 18px
margin: 5px 6px 0
padding: 0
text-align: center
width: 32px
}
.goods_add {
background: url("../images/plus.gif") no-repeat scroll 0 -15px transparent
border: 0 none
cursor: pointer
display: block
float: left
font-size: 0
height: 15px
line-height: 0
margin: 8px 3px 0
width: 15px
}
在flow.dwt里,看各自的模板去修改,总之要找到这串代码:
<input type="text" name="goods_number[{$goods.rec_id}]" ……
下面是脚本,放进flow.dwt里
<script language="javascript" type="text/javascript">
function goods_cut($val){
var num_val=document.getElementById('number'+$val)
var new_num=num_val.value
if(isNaN(new_num)){alert('请输入数字')return false}
var Num = parseInt(new_num)
if(Num>1)Num=Num-1
num_val.value=Num
document.getElementById('updatecart').click()
}
function goods_add($val){
var num_val=document.getElementById('number'+$val)
var new_num=num_val.value
if(isNaN(new_num)){alert('请输入数字')return false}
var Num = parseInt(new_num)
Num=Num+1
num_val.value=Num
document.getElementById('updatecart').click()
}
</script>
找到
<input type="text" name="goods_number[{$goods.rec_id}]"
搜索不到你就搜goods_number就行了
替换为:
<span class="goods_cut" onclick="goods_cut('{$goods.rec_id}')"></span>
<input type="text" name="goods_number[{$goods.rec_id}]" id="number{$goods.rec_id}" value="{$goods.goods_number}" size="4" class="number" onblur="if(isNaN(this.value)){alert('请输入数字')return false}else{document.getElementById('updatecart').click()}" title="{$lang.goods_number_tip}"/>
<span class="goods_add" onclick="goods_add('{$goods.rec_id}')"></span>
找到
<input name="submit" type="submit" value="{$lang.update_cart}" class="btn_s3"/>
其实就是更新购物车的按钮
添加一个id=“updatecart”
<input name="submit" type="submit" id="updatecart" value="{$lang.update_cart}" class="btn_s3"/>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)