Future 3 years ago
parent
commit
142c73f121
1 changed files with 25 additions and 0 deletions
  1. 25 0
      src/main/webapp/ShoppingCart.html

+ 25 - 0
src/main/webapp/ShoppingCart.html

@@ -90,5 +90,30 @@
             </div>
         </div>
     </div>
+
+    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
+    <script>
+        $("div#Cartlist>div#Store>div.goods>div#exp>div#count>Button").click(function()
+        {
+            if(this.innerHTML == "-")
+            {
+                let text = $(this).next()[0];
+                let num = Number.parseInt(text.value);
+                console.dir(num);
+                if(num.toString() == "NaN") num = 0;
+                else num = Math.max(0,--num);
+                text.value = num;
+            }
+            else
+            {
+                let text = $(this).prev()[0];
+                let num = Number.parseInt(text.value);
+                console.dir(num);
+                if(num.toString() == "NaN") num = 1;
+                else num = Math.max(0,++num);
+                text.value = num;
+            }
+        })
+    </script>
 </body>
 </html>