The example of this article shares an HTML simple shopping quantity applet for your reference. The specific content is as follows
<html> <head> <title>购物数量小程序</title> <script> function sub() { var a = buy.ans.value; //alert(a); a = parseInt(a); a--; if(a<0) a = 0; buy.ans.value = a; } function add() { var a = buy.ans.value; a = parseInt(a); a++; buy.ans.value = a; } </script> </head> <body> <form name="buy"> 购买数量<input type="button" value="-" onclick="sub()"> <input type="text" name="ans" value="1"> <input type="button" value="+" onclick="add()"> </form> </body> </html>
The above is the entire content of this article. I hope it will be helpful to everyone. Learning is helpful, and I hope everyone will support the PHP Chinese website.
For more HTML simple shopping quantity applet related articles, please pay attention to the PHP Chinese website!