source: schedule/js/function.php@ 15497

Last change on this file since 15497 was 15497, checked in by tanio, 12 years ago
update with database
File size: 13.4 KB
Line 
1<script type="text/javascript">
2 $(document).ready(function(){
3 var cnt=2;
4 var table = document.createElement("table");
5 table.setAttribute('id',"table2");
6 table.setAttribute('width','100%');
7 var tr = document.createElement('tr');
8 var td3=document.createElement('td');
9 td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
10 td3.appendChild(
11 input = document.createElement("input"),
12 input.setAttribute("type","time"),
13 input.setAttribute("id","Time"),
14 input.setAttribute("max","24"),
15 input.setAttribute("min","1"),
16 input.setAttribute("required")
17 )
18 var td=document.createElement('td');
19 td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
20 td.appendChild(
21 sourcecbo= document.createElement('select'),
22 sourcecbo.setAttribute('id','source'),
23<?php
24
25 $source=mysql_query("SELECT*FROM source");
26 while($rowsource=mysql_fetch_array($source))
27 {
28?>
29 sourcecbo.appendChild(
30 option=document.createElement('option'),
31
32 option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
33 option.setAttribute('selected',true),
34 option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
35 ),
36<?php
37 }
38?>
39 sourcecbo.setAttribute('id','source')
40
41 );
42 var td1=document.createElement('td');
43 td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
44 td1.appendChild(
45 measurementcbo= document.createElement('select'),
46 measurementcbo.setAttribute('id','measurement'),
47<?php
48
49 $measure=mysql_query("SELECT*FROM measurement");
50 while($rowmeasure=mysql_fetch_array($measure))
51 {
52?>
53 measurementcbo.appendChild(
54 option=document.createElement('option'),
55 option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
56 option.setAttribute('selected',true),
57 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
58 ),
59<?php
60 }
61?>
62 measurementcbo.setAttribute('id','measurement')
63 );
64 var td2=document.createElement('td');
65 td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
66 td2.appendChild(
67 input = document.createElement('input'),
68 input.setAttribute('type','text'),
69 input.setAttribute('id','txtData')
70
71 );
72 var td4=document.createElement('td');
73 td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
74 td4.appendChild(
75 button = document.createElement('input'),
76 button.setAttribute("type",'button'),
77 button.setAttribute('id','btnSplit'),
78 button.setAttribute('value','Split'),
79 button.onclick= function()
80 {
81 split1();
82 }
83 );
84 td4.appendChild(
85 button=document.createElement('input'),
86 button.setAttribute('type','button'),
87 button.setAttribute('value','Delete'),
88 button.setAttribute('id','btnDelete'),
89 button.onclick=function(){
90 $('#table2').remove();
91 }
92 );
93 tr.appendChild(td3);
94 tr.appendChild(td);
95 tr.appendChild(td1);
96 tr.appendChild(td2);
97 tr.appendChild(td4);
98 table.appendChild(tr);
99 $('#TableH1').append(table);
100
101
102 var table = document.createElement("table");
103 table.setAttribute('id',"table1");
104 table.setAttribute('width','100%');
105 var tr = document.createElement('tr');
106 tr.setAttribute('id','');
107 tr.setAttribute('class','');
108 var td3=document.createElement('td');
109 td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
110 td3.appendChild(
111 input = document.createElement("input"),
112 input.setAttribute("type","time"),
113 input.setAttribute("id","Time"),
114 input.setAttribute("max","24"),
115 input.setAttribute("min","1"),
116 input.setAttribute("required")
117 )
118 var td=document.createElement('td');
119 td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
120 td.appendChild(
121 sourcecbo= document.createElement('select'),
122 sourcecbo.setAttribute('id','source'),
123<?php
124
125 $source=mysql_query("SELECT*FROM source");
126 while($rowsource=mysql_fetch_array($source))
127 {
128?>
129 sourcecbo.appendChild(
130 option=document.createElement('option'),
131
132 option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
133 option.setAttribute('selected',true),
134 option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
135 ),
136<?php
137 }
138?>
139 sourcecbo.setAttribute('id','source')
140
141 );
142 var td1=document.createElement('td');
143 td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
144 td1.appendChild(
145 measurementcbo= document.createElement('select'),
146 measurementcbo.setAttribute('id','measurement'),
147<?php
148
149 $measure=mysql_query("SELECT*FROM measurement");
150 while($rowmeasure=mysql_fetch_array($measure))
151 {
152?>
153 measurementcbo.appendChild(
154 option=document.createElement('option'),
155 option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
156 option.setAttribute('selected',true),
157 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
158 ),
159<?php
160 }
161?>
162 measurementcbo.setAttribute('id','measurement')
163 );
164 var td2=document.createElement('td');
165 td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
166 td2.appendChild(
167 input = document.createElement('input'),
168 input.setAttribute('type','text'),
169 input.setAttribute('id','txtData')
170
171 );
172 var td4=document.createElement('td');
173 td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
174 td4.appendChild(
175 button = document.createElement('input'),
176 button.setAttribute("type",'button'),
177 button.setAttribute('id','btnSplit'),
178 button.setAttribute('value','Split'),
179 button.onclick= function()
180 {
181 split();
182 }
183 );
184 td4.appendChild(
185 button=document.createElement('input'),
186 button.setAttribute('type','button'),
187 button.setAttribute('value','Delete'),
188 button.setAttribute('id','btnDelete'),
189 button.onclick=function(){
190 $('#table1').remove();
191
192 }
193 );
194 tr.appendChild(td3);
195 tr.appendChild(td);
196 tr.appendChild(td1);
197 tr.appendChild(td2);
198 tr.appendChild(td4);
199 table.appendChild(tr);
200 $('#TableH').append(table);
201
202 function split()
203 {
204
205 cnt++;
206 var table = document.createElement("table");
207 table.setAttribute('id',"table"+cnt);
208 table.setAttribute('width','100%');
209 var tr = document.createElement('tr');
210 tr.setAttribute('id','');
211 tr.setAttribute('class','');
212 var td3=document.createElement('td');
213 td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
214 td3.appendChild(
215 input = document.createElement("input"),
216 input.setAttribute("type","time"),
217 input.setAttribute("id","Time"),
218 input.setAttribute("max","24"),
219 input.setAttribute("min","1"),
220 input.setAttribute("required")
221 )
222 var td=document.createElement('td');
223 td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
224 td.appendChild(
225 sourcecbo= document.createElement('select'),
226 sourcecbo.setAttribute('id','source'),
227<?php
228
229 $source=mysql_query("SELECT*FROM source");
230 while($rowsource=mysql_fetch_array($source))
231 {
232?>
233 sourcecbo.appendChild(
234 option=document.createElement('option'),
235
236 option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
237 option.setAttribute('selected',true),
238 option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
239 ),
240<?php
241 }
242?> sourcecbo.setAttribute('id','source')
243
244 );
245 var td1=document.createElement('td');
246 td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
247 td1.appendChild(
248 measurementcbo= document.createElement('select'),
249 measurementcbo.setAttribute('id','measurement'),
250<?php
251
252 $measure=mysql_query("SELECT*FROM measurement");
253 while($rowmeasure=mysql_fetch_array($measure))
254 {
255?>
256 measurementcbo.appendChild(
257 option=document.createElement('option'),
258 option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
259 option.setAttribute('selected',true),
260 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
261 ),
262<?php
263 }
264?>
265 measurementcbo.setAttribute('id','measurement')
266 );
267 var td2=document.createElement('td');
268 td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
269 td2.appendChild(
270 input = document.createElement('input'),
271 input.setAttribute('type','text'),
272 input.setAttribute('id','txtData')
273
274 );
275 var td4=document.createElement('td');
276 td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
277 td4.appendChild(
278 button = document.createElement('input'),
279 button.setAttribute("type",'button'),
280 button.setAttribute('id','btnSplit'),
281 button.setAttribute('value','Split'),
282 button.onclick=function(){
283 split();
284 }
285 );
286 td4.appendChild(
287 button=document.createElement('input'),
288 button.setAttribute('type','button'),
289 button.setAttribute('value','Delete'),
290 button.setAttribute('id','btnDelete'),
291 button.onclick=function(){
292 $('#table'+cnt).remove();
293 cnt--;
294 }
295 );
296 tr.appendChild(td3);
297 tr.appendChild(td);
298 tr.appendChild(td1);
299 tr.appendChild(td2);
300 tr.appendChild(td4);
301 table.appendChild(tr);
302 $('#TableH').append(table);
303 }
304 function split1()
305 {
306 cnt++;
307 var table = document.createElement("table");
308 table.setAttribute('id',"table"+cnt);
309 table.setAttribute('width','100%');
310 var tr = document.createElement('tr');
311 tr.setAttribute('id','');
312 tr.setAttribute('class','');
313 var td3=document.createElement('td');
314 td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
315 td3.appendChild(
316 input = document.createElement("input"),
317 input.setAttribute("type","time"),
318 input.setAttribute("id","Time"),
319 input.setAttribute("max","24"),
320 input.setAttribute("min","1"),
321 input.setAttribute("required")
322 )
323 var td=document.createElement('td');
324 td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
325 td.appendChild(
326 sourcecbo= document.createElement('select'),
327 sourcecbo.setAttribute('id','source'),
328<?php
329
330 $source=mysql_query("SELECT*FROM source");
331 while($rowsource=mysql_fetch_array($source))
332 {
333?>
334 sourcecbo.appendChild(
335 option=document.createElement('option'),
336
337 option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
338 option.setAttribute('selected',true),
339 option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
340 ),
341<?php
342 }
343?>
344 sourcecbo.setAttribute('id','source')
345
346 );
347 var td1=document.createElement('td');
348 td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
349 td1.appendChild(
350 measurementcbo= document.createElement('select'),
351 measurementcbo.setAttribute('id','measurement'),
352<?php
353
354 $measure=mysql_query("SELECT*FROM measurement");
355 while($rowmeasure=mysql_fetch_array($measure))
356 {
357?>
358 measurementcbo.appendChild(
359 option=document.createElement('option'),
360 option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
361 option.setAttribute('selected',true),
362 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
363 ),
364<?php
365 }
366?> measurementcbo.setAttribute('id','measurement')
367 );
368 var td2=document.createElement('td');
369 td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
370 td2.appendChild(
371 input = document.createElement('input'),
372 input.setAttribute('type','text'),
373 input.setAttribute('id','txtData')
374
375 );
376 var td4=document.createElement('td');
377 td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
378 td4.appendChild(
379 button = document.createElement('input'),
380 button.setAttribute("type",'button'),
381 button.setAttribute('id','btnSplit'),
382 button.setAttribute('value','Split'),
383 button.onclick=function(){
384 split();
385 }
386 );
387 td4.appendChild(
388 button=document.createElement('input'),
389 button.setAttribute('type','button'),
390 button.setAttribute('value','Delete'),
391 button.setAttribute('id','btnDelete'),
392 button.onclick=function(){
393 $('#table'+cnt).remove();
394 cnt--;
395 });
396 tr.appendChild(td3);
397 tr.appendChild(td);
398 tr.appendChild(td1);
399 tr.appendChild(td2);
400 tr.appendChild(td4);
401 table.appendChild(tr);
402 $('#TableH1').append(table);
403 }
404 });
405 </script>
Note: See TracBrowser for help on using the repository browser.