Front end development of the convenience store cashier system code

Time:2021-1-25

1 + X front end primary JQ

Community convenience store cashier system code

在这里插入图片描述

<body>
 <input type="text" value="" disabled="disabled" />
 <form action="" method="">
 <span>4.5</span>
 <input type="button" onclick="addClick(4.5)" value="+" /><br>
 <span>15</span>
 <input type="button" onclick="addClick(15)" value="+" /><br>
 <span>5</span>
 <input type="button" onclick="addClick(5)" value="+" /><br>
 </form>
 < input type = "button" name = "value =" check out "onclick =" sub() "/ >
 < input type = "button" name = "value =" transaction completed "onclick =" reload() "/ > 0
 </body>
addClick = (price) => {  
 Let result = $('# t'). Val(); // get the value from the form
 If (result = = =) {// if empty
 $('# t'). Val (price); // enter the value into the # t (display box)
 } else {
 $('# t'). Val (result + "+" + price); // if it is not empty, add a + link price after value
 }
 }
 sub = () => {
 let result = $('#t').val();
 // let a = [];
 let sum = 0;
 if (result != "") {
 var count =  result.split ('+'); // count is an array object cut by a + sign
 for (let i = 0; i < count.length; i++) {
  Sum + = parsefloat (count [i]); // take it out and take the value
 }
 $('# t'). Val ("total amount: + sum)";
 disableBtn();
 transparency();
 }
 }
 
 disableBtn = () => {
 $('#JZ').attr('disabled', 'disabled');
 }
 
 transparency = () => {
 $("#main").css("transition","all 1s");
 $("#main").css("opacity","0.3");
 }
 
 reload=()=>{
 location.reload();
 }

summary

The above is Xiaobian to introduce the front-end development of the convenience store cashier system code, hope to help you, if you have any questions, please leave me a message, Xiaobian will reply to you in time. Thank you very much for your support to developer!
If you think this article is helpful to you, please reprint, please indicate the source, thank you!

Recommended Today

Practice of query operation of database table (Experiment 3)

Following the previous two experiments, this experiment is to master the use of select statements for various query operations: single table query, multi table connection and query, nested query, set query, to consolidate the database query operation.Now follow Xiaobian to practice together!Based on the data table (student, course, SC, teacher, TC) created and inserted in […]