HTML simple shopping quantity applet

HTML simple shopping quantity applet

This article shares a simple HTML shopping quantity applet for your reference. The specific content is as follows

XML/HTML CodeCopy content to clipboard
  1. < html >   
  2.     < head >   
  3.   
  4.        < title > Shopping quantity applet </ title >   
  5.   
  6.      < script >   
  7. function sub()
  8. {
  9.   
  10. var a = buy.ans.value ;
  11. //alert(a);
  12.              a = parseInt (a);
  13. a--;
  14. if(a < 0 )
  15.               a = 0 ;
  16.              buy.ans.value = a;
  17. }
  18. function add()
  19. {
  20. var a = buy.ans.value ;
  21.              a = parseInt (a);
  22. a++;
  23.              buy.ans.value = a;
  24. }
  25.          </ script >   
  26.   
  27.     </ head >   
  28.   
  29.     < body >   
  30.       < form   name = "buy" >   
  31. Purchase quantity < input   type = "button"    value = "-"   onclick = "sub()" >   
  32.              < input   type = "text"   name = "ans"   value = "1" >   
  33.              < input   type = "button"    value = "+"   onclick = "add()" >   
  34.   
  35.       </ form >   
  36.      </ body >   
  37. </ html >   
  38.   

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

<<:  MySQL Tutorial: Subquery Example Detailed Explanation

>>:  3 Tips You Must Know When Learning JavaScript

Recommend

How to prevent duplicate submission in jquery project

In new projects, axios can prevent duplicate subm...

MySQL 8.0.22 winx64 installation and configuration method graphic tutorial

The database installation tutorial of MySQL-8.0.2...

Detailed steps to install Mysql5.7.19 using yum on Centos7

There is no mysql by default in the yum source of...

Ubuntu compiles kernel modules, and the content is reflected in the system log

Table of contents 1.Linux login interface 2. Writ...

Summary of javascript date tools

let Utils = { /** * Is it the year of death? * @r...

Analysis of the differences between Iframe and FRAME

1. Use of Iframe tag <br />When it comes to ...

Vue realizes the whole process of slider drag verification function

Rendering Define the skeleton, write HTML and CSS...

Centos7.5 installs mysql5.7.24 binary package deployment

1. Environmental preparation: Operating system: C...

Why MySQL can ignore time zone issues when using timestamp?

I have always wondered why the MySQL database tim...

Detailed explanation of Docker Volume permission management

Volume data volume is an important concept of Doc...

12 Laws of Web Design for Clean Code [Graphic]

Beautiful code is the foundation of a beautiful we...

CSS example code for setting scroll bar style

The CSS implementation code for setting the scrol...

How to delete the container created in Docker

How to delete the container created in Docker 1. ...

Circular progress bar implemented with CSS

Achieve results Implementation Code html <div ...

Implementation of new issues of CSS3 selectors

Table of contents Basic Selector Extensions Attri...