1 | <html>
|
---|
2 | <head>
|
---|
3 | <title></title>
|
---|
4 | <meta content="">
|
---|
5 | <style type="text/css">
|
---|
6 |
|
---|
7 | div.on#trobbler1 {
|
---|
8 | visibility : visible;
|
---|
9 | }
|
---|
10 |
|
---|
11 |
|
---|
12 | div.off#trobbler1 {
|
---|
13 | visibility : hidden;
|
---|
14 | }
|
---|
15 |
|
---|
16 |
|
---|
17 | div.on#trobbler2 {
|
---|
18 | visibility : visible;
|
---|
19 | }
|
---|
20 |
|
---|
21 |
|
---|
22 | div.off#trobbler2 {
|
---|
23 | visibility : hidden;
|
---|
24 | }
|
---|
25 |
|
---|
26 | div.on#trobbler3 {
|
---|
27 | visibility : visible;
|
---|
28 | }
|
---|
29 |
|
---|
30 |
|
---|
31 | div.off#trobbler3 {
|
---|
32 | visibility : hidden;
|
---|
33 | }
|
---|
34 |
|
---|
35 | </style>
|
---|
36 | <script type="text/javascript" src="../scripts/minimax.js"></script>
|
---|
37 | </head>
|
---|
38 | <body>
|
---|
39 | <input type="hidden" id="semaphore"/>
|
---|
40 | <script type="text/javascript">
|
---|
41 | var data1 = new minimax('data1.txt', 'div_data');
|
---|
42 | data1.setSemaphore('semaphore');
|
---|
43 | data1.setTrobbler('trobbler1', 'on', 'off');
|
---|
44 | var data2 = new minimax('data2.xml', 'div_data');
|
---|
45 | data2.setSemaphore('semaphore');
|
---|
46 | data2.setTrobbler('trobbler2', 'on', 'off');
|
---|
47 | var data3 = new minimax('data3.html', false);
|
---|
48 | data3.setSemaphore('semaphore');
|
---|
49 | data3.setTrobbler('trobbler3', 'on', 'off');
|
---|
50 | </script>
|
---|
51 | <div id='trobbler1' class='off'>Loading data1</div>
|
---|
52 | <div id='trobbler2' class='off'>Loading data2</div>
|
---|
53 | <div id='trobbler3' class='off'>Loading data3</div>
|
---|
54 | <div id='div_data'>This content will change</div>
|
---|
55 | <div>
|
---|
56 | <INPUT type="button" value="D1" onclick="
|
---|
57 | data1.get();
|
---|
58 | data1.xhr.onload = function() {
|
---|
59 | alert(data1.xhr.responseText);
|
---|
60 | }" />
|
---|
61 | <INPUT type="button" value="D2" onclick="
|
---|
62 | data2.post('a=1&b=2');" />
|
---|
63 | <INPUT type="button" value="D1 'and' D2" onclick="
|
---|
64 | data1.get();
|
---|
65 | data2.get(); " />
|
---|
66 | <INPUT type="button" value="D1 then D2" onclick="
|
---|
67 | data1.get();
|
---|
68 | data1.xhr.onload = function() {
|
---|
69 | alert(data1.xhr.responseText);
|
---|
70 | data2.get();
|
---|
71 | }" />
|
---|
72 | <INPUT type="button" value="D3" onclick="
|
---|
73 | data3.get();
|
---|
74 | data3.xhr.onload = function() {
|
---|
75 | alert(data3.xhr.responseText);
|
---|
76 | }" />
|
---|
77 | </div>
|
---|
78 | </body>
|
---|
79 | </html>
|
---|