-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathb.php
108 lines (82 loc) · 3.21 KB
/
b.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="Toshiba_AC.css">
<title>Increment/Decrement</title>
<script type = "text/javascript"
src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(temp){
// This button will increment the value
$('.tempup').click(function(e){
// Stop acting like a button
e.preventDefault();
// Get the field name
fieldName = $(this).attr('field');
// Get its current value
var currentVal = parseInt($('input[name='+fieldName+']').val());
// If is not undefined
if (!isNaN(currentVal)) {
// Increment only if value is < 20
if (currentVal < 30)
{
$('input[name='+fieldName+']').val(currentVal + 1);
$('.tempdn').val("DN").removeAttr('style');
}
else
{
$('.tempup').val("UP").css('color','#aaa');
$('.tempup').val("UP").css('cursor','not-allowed');
}
} else {
// Otherwise put a 0 there
$('input[name='+fieldName+']').val(1);
}
});
// This button will decrement the value till 17
$(".tempdn").click(function(e) {
// Stop acting like a button
e.preventDefault();
// Get the field name
fieldName = $(this).attr('field');
// Get its current value
var currentVal = parseInt($('input[name='+fieldName+']').val());
// If it isn't undefined or its greater than 17
if (!isNaN(currentVal) && currentVal > 17) {
// Decrement one only if value is > 1
$('input[name='+fieldName+']').val(currentVal - 1);
$('.tempup').val("UP").removeAttr('style');
} else {
// Otherwise put a 17 there
$('input[name='+fieldName+']').val(17);
$('.tempdn').val("DN").css('color','#aaa');
$('.tempdn').val("DN").css('cursor','not-allowed');
}
});
});
</script>
</head>
<body>
<div>
<div class="screen">
<input type='text' name='quantity' value='20' class='tempno' />
<br/>
<div class="space-even">
<div id="onoff" class="stat"> </div>
<div id="time" class="time"></div>
</div>
</div>
<h1>Input Number Incrementer</h1>
<form id='myform' method='POST' action='#' class="numbo">
<input type='button' value='UP' class='tempup' field='quantity' style="font-weight: bold;" /><br>
<!--<input type='text' name='quantity' value='20' class='qty' style="margin-bottom: 0px !important" onkeypress='return event.charCode >= 48 && event.charCode <= 57'/><br>-->
<input type='button' value='DN' class='tempdn' field='quantity' style="font-weight: bold;" />
</form>
</div>
<div class="button-cluster">
<div><a id="buttond" class="tempup" field='quantity' ><div class="up-arrow">▲</div></a></div> <!--➤-->
<div class="temp-div">TEMP</div>
<div><a id="buttone"class="tempdn"field='quantity' ><div class="dn-arrow">▼</div></a></div>
</div>
</body>
</html>