我希望在用户单击 - 按钮时不显示我的负面角色。计数应以 0 结束。现在也显示 -1、-2、-3 字符。我只想显示 0 或多于 0
<script type="text/javascript" >
function plus(){
var addplus = 1;
var plus = document.getElementById('qty').value;
addplus = parseInt(addplus) + parseInt(plus);
document.getElementById('qty').value = addplus;
}
function negtive(){
var neg;
var negtive = 1;
var negtives = document.getElementById('qty').value;
negtive = parseInt(negtives) - parseInt(negtive);
document.getElementById('qty').value = negtive;
}
</script>