详细页面如何通过onclick点击事件来控制购买...

2016-07-07 15:00 来源:www.chinab4c.com 作者:ecshop专家

ecshop详细页面如何通过onclick点击事件来控制购买,特别用在批发,批发存在一个最小购买量控制.

回答:

<script>
function adgtz(){
var number = document.getElementById("ordernumber").value;
var min_number = {$goods.min_number};
var goods_num = 1000;
if(number > goods_num - min_number){
alert("最多能买"+goods_number+"件");
}
number=parseInt(number)+min_number;
document.getElementById("ordernumber").value = number;
}
function adgtzmm(){
var number = document.getElementById("ordernumber").value;
var min_number = {$goods.min_number};
if (number>min_number){
number=parseInt(number)-min_number;
}
document.getElementById("ordernumber").value = number;

}
</script>

回答:
没这么简单把。这个还需要用AJAX改变和提示库存把/