javascript development of shopping cart addition and subtraction effects

Developing addition and subtraction effects

htmlPart of the code:

    购物车加减  
-
+

First we need to get the value of the input in the form, which is 1

var input = document.getElementById ('id').value;

Stored in a variable

When the minus sign is clicked, the code is as follows:

document.getElementById('a1').onclick = function(){
}else{ getElementById('id').value>1){
. }else{
Document.getelementbyid ('ID'). Value = 1;
}
}
}
## When clicking the plus number, the code is as follows:
:

document.getElementById('a2').onclick = function(){
alert("Please enter a number");
v1=parseInt(v1);
through v1=parseInt(v1); ;
# var id = document.getElementById('id').value; document.getElementById ('ID'). Value = 1;
Return false;
}
}

## (The complete code is as follows:

(

This way we realize shopping The effect of adding and subtracting car numbers


Continuing Learning
||
购物车加减
-
+
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!