</pre><pre name="code" class="html"><html>
<head>
<script>
function add()
{
var a,b;
a=buy.num.value;
b=parseInt(a);
b++;
buy.num.value=b;
}
function sub(){
var a,b;
a=buy.num.value;
b=parseInt(a);
if(b<=0)
b=0;
else
b--;
buy.num.value=b;
}
</script>
</head>
<body>
<form name = "buy">
<p><input type = "button" value ="-" onclick = "sub()">
<input type = "text" name = "num" value = "1" size = "10">
<input type = "button" value = "+" onclick = "add()"></p>
</form>
</body>
</html>
web 购物 加减小程序
最新推荐文章于 2021-08-19 20:51:32 发布