方法一:
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" >
|