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

jQuery implements all selection and reverse selection operation case

This article shares the specific code of jQuery t...

Detailed explanation of JavaScript onblur and onfocus events

In HTML pages, visual elements such as buttons an...

iframe parameters with instructions and examples

<iframe src=”test.jsp” width=”100″ height=”50″...

Javascript operation mechanism Event Loop

Table of contents 1. Four concepts 1. JavaScript ...

Analysis and solution of MySQL connection throwing Authentication Failed error

[Problem description] On the application side, th...

Vue uses rules to implement form field validation

There are many ways to write and validate form fi...

Detailed example of MySQL joint table update data

1.MySQL UPDATE JOIN syntax In MySQL, you can use ...

Web page experience: Web page color matching

<br />The color of a web page is one of the ...

Summary of commonly used operators and functions in MySQL

Let’s build the data table first. use test; creat...

Common CSS Errors and Solutions

Copy code The code is as follows: Difference betw...

Refs and Ref Details in Vue3

The editor also shares with you the corresponding...

Super detailed basic JavaScript syntax rules

Table of contents 01 JavaScript (abbreviated as: ...

Two ways to specify the character set of the html page

1. Two ways to specify the character set of the h...