js-tijd-aanpassen

Gesponsorde koppelingen

PHP script bestanden

  1. js-tijd-aanpassen

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<html>

<head>
   <title>Time counter</title>
   <script type="text/javascript">
      var mouseDown = false;
      var countType;
      var counter = 0;
      var nextTime;
      var minutes;
      var hours;

      function hour ()
      {
         if (isNaN(hours.value))
         {
            hours.value = "00";
         }

         if (countType)
         {
            if (hours.value == 23)
            {
               hours.value = "00";
            }
            else
            {
               hours.value ++;
            }
         }
         else
         {
            if (hours.value == 00)
            {
               hours.value = "23";
            }
            else
            {
               hours.value --;
            }
         }

         if (hours.value < 10 && hours.value > 0)
         {
            hours.value = "0" + hours.value;
         }
      }

      function count ()
      {
         if (mouseDown)
         {
            if (isNaN(minutes.value))
            {
               minutes.value = "00";
            }

            counter++;

            if (countType)
            {
               if (minutes.value == 59)
               {
                  minutes.value = "00";
                  hour();
               }
               else
               {
                  minutes.value ++;
               }
            }
            else
            {
              if (minutes.value == 00)
               {
                  minutes.value = "59";
                  hour();
               }
               else
               {
                  minutes.value --;
               }
            }

            if (minutes.value < 10 && minutes.value > 0)
            {
               minutes.value = "0" + minutes.value;
            }

            nextTime = 200 / counter;

            if (nextTime < 10)
            {
               nextTime = 5;
            }

            setTimeout('count();', nextTime);
         }
      }

      function startCount (type, idMinutes, idHours)
      {
         mouseDown = true;
         countType = type;
         minutes = document.getElementById(''+idMinutes+'');
         hours = document.getElementById(''+idHours+'');
         counter = 0;
         count();
      }

      function stopCount ()
      {
         mouseDown = false;
      }
   </script>

   <style type="text/css">
      #scheidingsteken
      {
         float: left;
         font-weight: bold;
      }

      #up
      {
         position: absolute;
         right: 0px;
         top: 0px;
      }

      #down
      {
         position: absolute;
         right: 0px;
         bottom: 0px;
      }

      #uren
      {
         border: 1px solid #ccc;
         float: left;
         position: relative;
         width: 20px;
      }

      #uren input
      {
         border: 0;
         font: 11px verdana;
         width: 20px;
      }

      #minuten
      {
         border: 1px solid #ccc;
         float: left;
         position: relative;
         width: 35px;
      }

      #minuten input
      {
         border: 0;
         font: 11px verdana;
         width: 35px;
      }
   </style>
</head>

<body>
   <div id="uren">
      <input disabled="disabled" id="uren_input" maxlength="2" type="text" value="<?php echo date('H'); ?>" />
   </div>
   <div id="scheidingsteken">
      :
   </div>
   <div id="minuten">
      <input disabled="disabled" id="minuten_input" type="text" maxlength="2" value="<?php echo date('i'); ?>" />
      <img id="up" src="up.gif" onmousedown="startCount(true, 'minuten_input', 'uren_input');" onmouseup="stopCount();" onmouseout="stopCount();" />
      <img id="down" src="down.gif" onmousedown="startCount(false, 'minuten_input', 'uren_input');" onmouseup="stopCount();" onmouseout="stopCount();" />
   </div>
</body>

</html>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.