source: schedule/function/SplitDelete.php@ 16112

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