source: schedule/function/function.php@ 16683

Last change on this file since 16683 was 16683, checked in by tanio, 12 years ago
File size: 1.9 KB
Line 
1 <div id="saving">
2 <script type="text/javascript">
3
4
5
6
7
8
9
10
11 $(document).ready(function(){
12 // for fupdate
13
14
15
16 var currentDate2 = new Date();
17 var day2 = currentDate2.getDate();
18 var month2 = currentDate2.getMonth() + 1;
19 var year2 = currentDate2.getFullYear();
20 var fullday2=day2+'-'+month2+'-'+year2;
21
22 var day;
23 var month;
24 var year;
25 var fullday;
26 <?php
27 if($_GET['day'] || $_GET['month'] || $_GET['year']){
28
29 ?>
30
31 day = <?php echo $_GET['day']; ?>;
32 month = <?php echo $_GET['month']; ?>;
33 year = <?php echo $_GET['year']; ?>;
34 fullday=day+'-'+month+'-'+year;
35
36
37
38 <?php
39
40
41 }else{
42
43 ?>
44 var currentDate = new Date();
45 day = currentDate.getDate();
46 month = currentDate.getMonth() + 1;
47 year = currentDate.getFullYear();
48 fullday=day+'-'+month+'-'+year;
49 <?php } ?>
50
51 <?php
52
53
54
55 $cntsource=mysql_query("SELECT COUNT(*) as `SourceID` FROM source");
56 $rowcnt=mysql_fetch_array($cntsource);
57 $Total= $rowcnt['SourceID'];
58 ?>
59 $('#save').click(function(){
60 alert(getDate());
61
62 var InputValue = [];
63 var selectedSource = [];
64 var selectedTime = [];
65 var selectedMeasurement = [];
66 var Time;
67 var Source;
68 var measure;
69 var value;
70 var checks = 0;
71 for(var i=1;i <= cnt;i++)
72 {
73 if($('#Time'+i).val() != '')
74 {
75 Time=$('#Time'+i).val();
76 Source=$('select[id="source'+i+'"]').val();
77 measure=$('select[id="measurement'+i+'"]').val();
78 value=$('#txtData'+i).val();
79 selectedMeasurement.push(measure);
80 selectedSource.push(Source);
81 selectedTime.push(Time);
82 InputValue.push(value);
83
84 }else{
85 checks++;
86
87 }
88 }
89
90 if(checks == 0){
91 //window.location = 'Transaction/insert.php?Time='+selectedTime+'&Source='+selectedSource+'&measure='+selectedMeasurement+'&Data='+InputValue+'&Date='+fullday+'&Date2='+fullday2;
92 }else{
93
94 alert("Please fill all the details!");
95 }
96 });
97
98 });
99 </script>
100 </div>
Note: See TracBrowser for help on using the repository browser.