1 | <script type="text/javascript">
|
---|
2 | $(document).ready(function(){
|
---|
3 | var timeValue;
|
---|
4 | var meas;
|
---|
5 | var meas2;
|
---|
6 | var cnt=2;
|
---|
7 | var table = document.createElement("table");
|
---|
8 | table.setAttribute('id',"table2");
|
---|
9 | table.setAttribute('width','100%');
|
---|
10 | var tr = document.createElement('tr');
|
---|
11 | var td3=document.createElement('td');
|
---|
12 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
---|
13 | td3.appendChild(
|
---|
14 | input = document.createElement("input"),
|
---|
15 | input.setAttribute("type","time"),
|
---|
16 | input.setAttribute("id","Time1"),
|
---|
17 | input.setAttribute("max","24"),
|
---|
18 | input.setAttribute("min","1"),
|
---|
19 | input.setAttribute("required",true)
|
---|
20 |
|
---|
21 | )
|
---|
22 | var td=document.createElement('td');
|
---|
23 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
---|
24 | td.appendChild(
|
---|
25 | sourcecbo= document.createElement('select'),
|
---|
26 | sourcecbo.setAttribute('id','source1'),
|
---|
27 | <?php
|
---|
28 | $source=mysql_query("SELECT*FROM source");
|
---|
29 | while($rowsource=mysql_fetch_array($source))
|
---|
30 | {
|
---|
31 | ?>
|
---|
32 | sourcecbo.appendChild(
|
---|
33 | option=document.createElement('option'),
|
---|
34 |
|
---|
35 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
---|
36 | option.setAttribute('selected',true),
|
---|
37 |
|
---|
38 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
---|
39 |
|
---|
40 |
|
---|
41 | ),
|
---|
42 | <?php
|
---|
43 | }
|
---|
44 | ?>
|
---|
45 | sourcecbo.setAttribute('id','source1')
|
---|
46 |
|
---|
47 | );
|
---|
48 | var td1=document.createElement('td');
|
---|
49 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
---|
50 | td1.appendChild(
|
---|
51 | measurementcbo= document.createElement('select'),
|
---|
52 | measurementcbo.setAttribute('id','measurement1'),
|
---|
53 | <?php
|
---|
54 | $measure=mysql_query("SELECT*FROM measurement");
|
---|
55 | while($rowmeasure=mysql_fetch_array($measure))
|
---|
56 | {
|
---|
57 | ?>
|
---|
58 | measurementcbo.appendChild(
|
---|
59 | option=document.createElement('option'),
|
---|
60 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
---|
61 | option.setAttribute('selected',true),
|
---|
62 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
---|
63 | ),
|
---|
64 | <?php
|
---|
65 | }
|
---|
66 | ?>
|
---|
67 | measurementcbo.setAttribute('id','measurement1')
|
---|
68 | );
|
---|
69 | var td2=document.createElement('td');
|
---|
70 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
---|
71 | td2.appendChild(
|
---|
72 | input = document.createElement('input'),
|
---|
73 | input.setAttribute('type','text'),
|
---|
74 | input.setAttribute('id','txtData1')
|
---|
75 |
|
---|
76 |
|
---|
77 | );
|
---|
78 | var td4=document.createElement('td');
|
---|
79 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
---|
80 | td4.appendChild(
|
---|
81 | button = document.createElement('input'),
|
---|
82 | button.setAttribute("type",'button'),
|
---|
83 | button.setAttribute('id','btnSplit'),
|
---|
84 | button.setAttribute('value','Split'),
|
---|
85 | button.onclick= function()
|
---|
86 | {
|
---|
87 | meas = "name"; meas2 = "time";
|
---|
88 | timeValue = "";
|
---|
89 | split1();
|
---|
90 |
|
---|
91 |
|
---|
92 | }
|
---|
93 | );
|
---|
94 | td4.appendChild(
|
---|
95 | button=document.createElement('input'),
|
---|
96 | button.setAttribute('type','button'),
|
---|
97 | button.setAttribute('value','Delete'),
|
---|
98 | button.setAttribute('id','btnDelete'),
|
---|
99 | button.onclick=function(){
|
---|
100 | $('#table2').remove();
|
---|
101 | }
|
---|
102 | );
|
---|
103 | td4.appendChild(
|
---|
104 | button=document.createElement('input'),
|
---|
105 | button.setAttribute('type','button'),
|
---|
106 | button.setAttribute('value','+Measurement'),
|
---|
107 | button.setAttribute('id','btnMeasurement'),
|
---|
108 | button.onclick=function(){
|
---|
109 |
|
---|
110 | if($('#Time1').val() != ""){ timeValue = $('#Time1').val(); meas = "disabled"; meas2 = true; split1(); }else{ alert("please enter value for time to add measurement"); }
|
---|
111 | }
|
---|
112 | );
|
---|
113 | tr.appendChild(td3);
|
---|
114 | tr.appendChild(td1);
|
---|
115 | tr.appendChild(td);
|
---|
116 |
|
---|
117 | tr.appendChild(td2);
|
---|
118 | tr.appendChild(td4);
|
---|
119 | table.appendChild(tr);
|
---|
120 | $('#TableH1').append(table);
|
---|
121 |
|
---|
122 |
|
---|
123 | var table = document.createElement("table");
|
---|
124 | table.setAttribute('id',"table1");
|
---|
125 | table.setAttribute('width','100%');
|
---|
126 | var tr = document.createElement('tr');
|
---|
127 | tr.setAttribute('id','');
|
---|
128 | tr.setAttribute('class','');
|
---|
129 | var td3=document.createElement('td');
|
---|
130 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
---|
131 | td3.appendChild(
|
---|
132 | input = document.createElement("input"),
|
---|
133 | input.setAttribute("type","time"),
|
---|
134 | input.setAttribute("id","Time2"),
|
---|
135 | input.setAttribute("max","24"),
|
---|
136 | input.setAttribute("min","1"),
|
---|
137 | input.setAttribute("required",true)
|
---|
138 | )
|
---|
139 | var td=document.createElement('td');
|
---|
140 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
---|
141 | td.appendChild(
|
---|
142 | sourcecbo= document.createElement('select'),
|
---|
143 | sourcecbo.setAttribute('id','source2'),
|
---|
144 | <?php
|
---|
145 | $source=mysql_query("SELECT*FROM source");
|
---|
146 | while($rowsource=mysql_fetch_array($source))
|
---|
147 | {
|
---|
148 | ?>
|
---|
149 | sourcecbo.appendChild(
|
---|
150 | option=document.createElement('option'),
|
---|
151 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
---|
152 | option.setAttribute('selected',true),
|
---|
153 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
---|
154 |
|
---|
155 | ),
|
---|
156 | <?php
|
---|
157 | }
|
---|
158 | ?>
|
---|
159 | sourcecbo.setAttribute('id','source2')
|
---|
160 |
|
---|
161 | );
|
---|
162 | var td1=document.createElement('td');
|
---|
163 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
---|
164 | td1.appendChild(
|
---|
165 | measurementcbo= document.createElement('select'),
|
---|
166 | measurementcbo.setAttribute('id','measurement2'),
|
---|
167 | <?php
|
---|
168 | $measure=mysql_query("SELECT*FROM measurement");
|
---|
169 | while($rowmeasure=mysql_fetch_array($measure))
|
---|
170 | {
|
---|
171 | ?>
|
---|
172 | measurementcbo.appendChild(
|
---|
173 | option=document.createElement('option'),
|
---|
174 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
---|
175 | option.setAttribute('selected',true),
|
---|
176 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
---|
177 | ),
|
---|
178 | <?php
|
---|
179 | }
|
---|
180 | ?>
|
---|
181 | measurementcbo.setAttribute('id','measurement2')
|
---|
182 | );
|
---|
183 | var td2=document.createElement('td');
|
---|
184 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
---|
185 | td2.appendChild(
|
---|
186 | input = document.createElement('input'),
|
---|
187 | input.setAttribute('type','text'),
|
---|
188 | input.setAttribute('id','txtData2')
|
---|
189 |
|
---|
190 | );
|
---|
191 | var td4=document.createElement('td');
|
---|
192 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
---|
193 | td4.appendChild(
|
---|
194 | button = document.createElement('input'),
|
---|
195 | button.setAttribute("type",'button'),
|
---|
196 | button.setAttribute('id','btnSplit'),
|
---|
197 | button.setAttribute('value','Split'),
|
---|
198 | button.onclick= function()
|
---|
199 | {
|
---|
200 | meas = "name"; meas2 = "time";
|
---|
201 | timeValue = "";
|
---|
202 | split();
|
---|
203 |
|
---|
204 | }
|
---|
205 | );
|
---|
206 | td4.appendChild(
|
---|
207 | button=document.createElement('input'),
|
---|
208 | button.setAttribute('type','button'),
|
---|
209 | button.setAttribute('value','Delete'),
|
---|
210 | button.setAttribute('id','btnDelete'),
|
---|
211 | button.onclick=function(){
|
---|
212 | $('#table1').remove();
|
---|
213 |
|
---|
214 | }
|
---|
215 | );
|
---|
216 | td4.appendChild(
|
---|
217 | button=document.createElement('input'),
|
---|
218 | button.setAttribute('type','button'),
|
---|
219 | button.setAttribute('value','+Measurement'),
|
---|
220 | button.setAttribute('id','btnMeasurement'),
|
---|
221 | button.onclick=function(){
|
---|
222 |
|
---|
223 |
|
---|
224 |
|
---|
225 | if($('#Time2').val() != ""){ timeValue = $('#Time2').val(); meas = "disabled"; meas2 = true; split(); }else{ alert("please enter value for time to add measurement"); }
|
---|
226 |
|
---|
227 | }
|
---|
228 | );
|
---|
229 | tr.appendChild(td3);
|
---|
230 | tr.appendChild(td1);
|
---|
231 | tr.appendChild(td);
|
---|
232 |
|
---|
233 | tr.appendChild(td2);
|
---|
234 | tr.appendChild(td4);
|
---|
235 | table.appendChild(tr);
|
---|
236 | $('#TableH').append(table);
|
---|
237 | var meas;
|
---|
238 | var timeValue;
|
---|
239 |
|
---|
240 | function split()
|
---|
241 | {
|
---|
242 | if(cnt <= 10){
|
---|
243 | cnt++;
|
---|
244 | var table = document.createElement("table");
|
---|
245 | table.setAttribute('id',"table"+cnt);
|
---|
246 | table.setAttribute('width','100%');
|
---|
247 | var tr = document.createElement('tr');
|
---|
248 | tr.setAttribute('id','');
|
---|
249 | tr.setAttribute('class','');
|
---|
250 |
|
---|
251 | var td3=document.createElement('td');
|
---|
252 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
---|
253 | td3.appendChild(
|
---|
254 | input = document.createElement("input"),
|
---|
255 | input.setAttribute("type","time"),
|
---|
256 | input.setAttribute("id","Time"+cnt),
|
---|
257 | input.setAttribute("max","24"),
|
---|
258 | input.setAttribute("min","1"),
|
---|
259 | input.setAttribute("required",true),
|
---|
260 | input.setAttribute(meas,meas2),
|
---|
261 | input.setAttribute("value",timeValue)
|
---|
262 |
|
---|
263 | );
|
---|
264 |
|
---|
265 | var td=document.createElement('td');
|
---|
266 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
---|
267 | td.appendChild(
|
---|
268 | sourcecbo= document.createElement('select'),
|
---|
269 | sourcecbo.setAttribute('id','source'+cnt),
|
---|
270 | <?php
|
---|
271 | $source=mysql_query("SELECT*FROM source");
|
---|
272 | while($rowsource=mysql_fetch_array($source))
|
---|
273 | {
|
---|
274 | ?>
|
---|
275 | sourcecbo.appendChild(
|
---|
276 | option=document.createElement('option'),
|
---|
277 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
---|
278 | option.setAttribute('selected',true),
|
---|
279 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
---|
280 |
|
---|
281 | ),
|
---|
282 | <?php
|
---|
283 | }
|
---|
284 | ?>
|
---|
285 | sourcecbo.setAttribute('id','source'+cnt)
|
---|
286 |
|
---|
287 | );
|
---|
288 | var td1=document.createElement('td');
|
---|
289 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
---|
290 | td1.appendChild(
|
---|
291 | measurementcbo= document.createElement('select'),
|
---|
292 | measurementcbo.setAttribute('id','measurement'+cnt),
|
---|
293 | <?php
|
---|
294 | $measure=mysql_query("SELECT*FROM measurement");
|
---|
295 | while($rowmeasure=mysql_fetch_array($measure))
|
---|
296 | {
|
---|
297 | ?>
|
---|
298 | measurementcbo.appendChild(
|
---|
299 | option=document.createElement('option'),
|
---|
300 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
---|
301 | option.setAttribute('selected',true),
|
---|
302 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
---|
303 | ),
|
---|
304 | <?php
|
---|
305 | }
|
---|
306 | ?>
|
---|
307 | measurementcbo.setAttribute('id','measurement'+cnt)
|
---|
308 | );
|
---|
309 | var td2=document.createElement('td');
|
---|
310 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
---|
311 | td2.appendChild(
|
---|
312 | input = document.createElement('input'),
|
---|
313 | input.setAttribute('type','text'),
|
---|
314 | input.setAttribute('id','txtData'+cnt)
|
---|
315 |
|
---|
316 | );
|
---|
317 | var td4=document.createElement('td');
|
---|
318 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
---|
319 | td4.appendChild(
|
---|
320 | button = document.createElement('input'),
|
---|
321 | button.setAttribute("type",'button'),
|
---|
322 | button.setAttribute('id','btnSplit'),
|
---|
323 | button.setAttribute('value','Split'),
|
---|
324 | button.onclick=function(){
|
---|
325 | timeValue = "";
|
---|
326 | meas = "name"; meas2 = "time";
|
---|
327 | split();
|
---|
328 | }
|
---|
329 | );
|
---|
330 | td4.appendChild(
|
---|
331 | button=document.createElement('input'),
|
---|
332 | button.setAttribute('type','button'),
|
---|
333 | button.setAttribute('value','Delete'),
|
---|
334 | button.setAttribute('id','btnDelete'),
|
---|
335 | button.onclick=function(){
|
---|
336 | $('#table'+cnt).remove();
|
---|
337 | cnt--;
|
---|
338 | }
|
---|
339 | );
|
---|
340 | td4.appendChild(
|
---|
341 | button=document.createElement('input'),
|
---|
342 | button.setAttribute('type','button'),
|
---|
343 | button.setAttribute('value','+Measurement'),
|
---|
344 | button.setAttribute('id','btnMeasurement'),
|
---|
345 | button.onclick=function(){
|
---|
346 | if($('#Time'+cnt).val() != ""){ timeValue = $('#Time'+cnt).val(); meas = "disabled"; meas2 = true; split(); }else{ alert("please enter value for time to add measurement"); }
|
---|
347 | }
|
---|
348 | );
|
---|
349 | tr.appendChild(td3);
|
---|
350 | tr.appendChild(td1);
|
---|
351 | tr.appendChild(td);
|
---|
352 |
|
---|
353 | tr.appendChild(td2);
|
---|
354 | tr.appendChild(td4);
|
---|
355 | table.appendChild(tr);
|
---|
356 | $('#TableH').append(table);
|
---|
357 | }else{
|
---|
358 |
|
---|
359 | alert(" only 10 sources are allowed! ");
|
---|
360 |
|
---|
361 | }
|
---|
362 |
|
---|
363 | }
|
---|
364 | function split1()
|
---|
365 | {
|
---|
366 | if(cnt <= 10){
|
---|
367 | cnt++;
|
---|
368 | var table = document.createElement("table");
|
---|
369 | table.setAttribute('id',"table"+cnt);
|
---|
370 | table.setAttribute('width','100%');
|
---|
371 | var tr = document.createElement('tr');
|
---|
372 | tr.setAttribute('id','');
|
---|
373 | tr.setAttribute('class','');
|
---|
374 |
|
---|
375 | var td3=document.createElement('td');
|
---|
376 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
---|
377 | td3.appendChild(
|
---|
378 | input = document.createElement("input"),
|
---|
379 | input.setAttribute("type","time"),
|
---|
380 | input.setAttribute("id","Time"+cnt),
|
---|
381 | input.setAttribute("max","24"),
|
---|
382 | input.setAttribute("min","1"),
|
---|
383 | input.setAttribute("required",true),
|
---|
384 | input.setAttribute(meas,meas2),
|
---|
385 | input.setAttribute("value",timeValue)
|
---|
386 | );
|
---|
387 |
|
---|
388 | var td=document.createElement('td');
|
---|
389 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
---|
390 | td.appendChild(
|
---|
391 | sourcecbo= document.createElement('select'),
|
---|
392 | sourcecbo.setAttribute('id','source'+cnt),
|
---|
393 | <?php
|
---|
394 | $source=mysql_query("SELECT*FROM source");
|
---|
395 | while($rowsource=mysql_fetch_array($source))
|
---|
396 | {
|
---|
397 | ?>
|
---|
398 | sourcecbo.appendChild(
|
---|
399 | option=document.createElement('option'),
|
---|
400 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
---|
401 | option.setAttribute('selected',true),
|
---|
402 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
---|
403 |
|
---|
404 | ),
|
---|
405 | <?php
|
---|
406 | }
|
---|
407 | ?>
|
---|
408 | sourcecbo.setAttribute('id','source'+cnt)
|
---|
409 |
|
---|
410 | );
|
---|
411 | var td1=document.createElement('td');
|
---|
412 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
---|
413 | td1.appendChild(
|
---|
414 | measurementcbo= document.createElement('select'),
|
---|
415 | measurementcbo.setAttribute('id','measurement'+cnt),
|
---|
416 | <?php
|
---|
417 | $measure=mysql_query("SELECT*FROM measurement");
|
---|
418 | while($rowmeasure=mysql_fetch_array($measure))
|
---|
419 | {
|
---|
420 | ?>
|
---|
421 | measurementcbo.appendChild(
|
---|
422 | option=document.createElement('option'),
|
---|
423 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
---|
424 | option.setAttribute('selected',true),
|
---|
425 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
---|
426 | ),
|
---|
427 | <?php
|
---|
428 | }
|
---|
429 | ?>
|
---|
430 | measurementcbo.setAttribute('id','measurement'+cnt)
|
---|
431 | );
|
---|
432 | var td2=document.createElement('td');
|
---|
433 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
---|
434 | td2.appendChild(
|
---|
435 | input = document.createElement('input'),
|
---|
436 | input.setAttribute('type','text'),
|
---|
437 | input.setAttribute('id','txtData'+cnt)
|
---|
438 |
|
---|
439 | );
|
---|
440 | var td4=document.createElement('td');
|
---|
441 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
---|
442 | td4.appendChild(
|
---|
443 | button = document.createElement('input'),
|
---|
444 | button.setAttribute("type",'button'),
|
---|
445 | button.setAttribute('id','btnSplit'),
|
---|
446 | button.setAttribute('value','Split'),
|
---|
447 | button.onclick=function(){
|
---|
448 | timeValue = "";
|
---|
449 | meas = "name"; meas2 = "time";
|
---|
450 | split1();
|
---|
451 | }
|
---|
452 | );
|
---|
453 | td4.appendChild(
|
---|
454 | button=document.createElement('input'),
|
---|
455 | button.setAttribute('type','button'),
|
---|
456 | button.setAttribute('value','Delete'),
|
---|
457 | button.setAttribute('id','btnDelete'),
|
---|
458 | button.onclick=function(){
|
---|
459 | $('#table'+cnt).remove();
|
---|
460 | cnt--;
|
---|
461 | });
|
---|
462 | td4.appendChild(
|
---|
463 | button=document.createElement('input'),
|
---|
464 | button.setAttribute('type','button'),
|
---|
465 | button.setAttribute('value','+Measurement'),
|
---|
466 | button.setAttribute('id','btnMeasurement'),
|
---|
467 | button.onclick=function(){
|
---|
468 | if($('#Time'+cnt).val() != ""){ timeValue = $('#Time'+cnt).val(); meas = "disabled"; meas2 = true; split1(); }else{ alert("please enter value for time to add measurement"); }
|
---|
469 |
|
---|
470 |
|
---|
471 | }
|
---|
472 | );
|
---|
473 | tr.appendChild(td3);
|
---|
474 | tr.appendChild(td1);
|
---|
475 | tr.appendChild(td);
|
---|
476 |
|
---|
477 | tr.appendChild(td2);
|
---|
478 | tr.appendChild(td4);
|
---|
479 | table.appendChild(tr);
|
---|
480 | $('#TableH1').append(table);
|
---|
481 | }else{
|
---|
482 |
|
---|
483 | alert(" only 10 sources are allowed! ");
|
---|
484 | }
|
---|
485 | }
|
---|
486 |
|
---|
487 | });
|
---|
488 | </script> |
---|