分享

[转载]ecshop购物流程中的购买数量的加减按钮

 总懂缘 2017-06-23

方法一:

1.复制以下JS代码,添加到 js/common.js 的最后


function cart_number(txt_id, type, num)
    num = num || 1;   
 var txt = document.getElementByIdx_x_x(txt_id);    
var source_num = parseInt(txt.value);   
 if (source_num == 1 && type == '-')   
   
 alert('请最少购买一个商品');  
       return;   
   
 var to_num       = source_num;    
if (type == '+')   
       
 to_num += num;   
    
else if (type == '-')   
     
   to_num -= num; 
     
  txt.value = to_num;  
  showdiv(txt);
 }

 

 

2.在flow.dwt中找到购买数量的文本框,在他的前后分别加上

<a href="javascript:cart_number('goods_number_{$goods.rec_id}', '-');">-</a>
<a href="javascript:cart_number('goods_number_{$goods.rec_id}', '+');">+</a>

 

 方法二:

在flow.dwt中找到购买数量的文本框,在他的前后分别加上

<IMG style="PADDING-LEFT: 0px; CURSOR: pointer"
onclick='if (document.getElementByIdx_x("number").value>1){document.getElementByIdx_x("number").value--;}'
src="images/down.gif" > 

 <INPUT id=number style="WIDTH: 40px; TEXT-ALIGN: right" maxLength=4
value=1 name=cart_quantity> 


 <IMG style="PADDING-RIGHT: 30px; MARGIN: 0px; WIDTH: 25px; CURSOR: pointer" onclick='document.getElementByIdx_x("number").value++;'
src="images/up.gif" >



    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多