1<div class="container">
2<input type="button" onclick="decrementValue()" value="-" />
3<input type="text" name="quantity" value="1" maxlength="2" max="10" size="1" id="number" />
4<input type="button" onclick="incrementValue()" value="+" />
5</div>
6
1<script type="text/javascript">
2function incrementValue()
3{
4 var value = parseInt(document.getElementById('number').value, 10);
5 value = isNaN(value) ? 0 : value;
6 if(value<10){
7 value++;
8 document.getElementById('number').value = value;
9 }
10}
11function decrementValue()
12{
13 var value = parseInt(document.getElementById('number').value, 10);
14 value = isNaN(value) ? 0 : value;
15 if(value>1){
16 value--;
17 document.getElementById('number').value = value;
18 }
19
20}
21</script>
22