r9065@llin: dpavlin | 2005-11-23 01:15:39 +0100
[webpac2] / web / iwf / testers / iwfajax.html
1 <html>\r
2         <head>\r
3                 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\r
4                 <style>\r
5                         .altrow { background-color: lightgrey; }\r
6                 </style>\r
7 \r
8                 <script type='text/javascript' src='../iwfcore.js'></script>\r
9                 <script type='text/javascript' src='../iwfxml.js'></script>\r
10                 <script type='text/javascript' src='../iwfgui.js'></script>\r
11                 <script type='text/javascript' src='../iwfajax.js'></script>\r
12 \r
13                 <script type='text/javascript'>\r
14 \r
15                         function testError(s){\r
16                                         alert("Test page error: Could not locate element with id of '" + s + "'");\r
17                                         return false;\r
18                         }\r
19 \r
20                         function getSource(id){\r
21                                 var el = iwfGetById(id);\r
22                                 if (!el){\r
23                                         return testError(id);\r
24                                 } else {\r
25                                         return el;\r
26                                 }\r
27                         }\r
28 \r
29                         function getTarget(id){\r
30                                 var el = getSource(id);\r
31                                 if (el){\r
32                                         var tgt = iwfGetById(el.value);\r
33                                         if (!tgt){\r
34                                                 alert('No element exists on this page with an id attribute of "' + el.value + '"');\r
35                                                 return false;\r
36                                         } else {\r
37                                                 return tgt;\r
38                                         }\r
39                                 }\r
40                                 return false;\r
41                         }\r
42 \r
43                         function testGetById(){\r
44                                 var tgt = getTarget('txtGetById');\r
45                                 if (tgt){\r
46                                         alert(iwfElementToString(tgt));\r
47                                 }\r
48                         }\r
49 \r
50                         function testXmlEncode(){\r
51                                 var el = getSource('txtXmlEncode');\r
52                                 if (el){\r
53                                         alert(iwfXmlEncode(el.innerText));\r
54                                 }\r
55 \r
56                         }\r
57 \r
58 \r
59                         function test(w){\r
60                                 alert(w);\r
61                                 for(var i=0;i<w.attributes.length;i++){\r
62                                         alert(w.getAttribute(i));\r
63                                 }\r
64                         }\r
65                 </script>\r
66 \r
67         </head>\r
68         <body onclick2='javascript:iwfMoveTo("moveme", iwfEvent(event).X, iwfEvent(event).Y, 10)'>\r
69                 <h1>Tester for iwfajax.js</h1>\r
70                 <a href='javascript:iwfAlignTo("moveme", "formSubmitResults", "tc", "bc", 30);'>Align orange to Result</a><br />\r
71                 <a href='javascript:iwfDockTo("moveme", "iwfContent", "tc", "bc", 30); '>Dock orange to iwfContent</a><br />\r
72                 <a href='javascript:iwfUnDockFrom("moveme", "iwfContent", 30); '>Undock orange from iwfContent</a><br />\r
73                 <a href='javascript:iwfMoveTo("iwfContent", 300, 300, 10); '>Move iwfContent</a><br />\r
74                 <a href='javascript:iwfMoveTo("iwfContent", 100, 500, 10); '>Reset iwfContent</a><br />\r
75                 <div id='moveme' style='background-color:orange; width:100px; top:10px; left:50px;position:absolute'>This should move</div><br />\r
76                 <a href='javascript:iwfMoveTo("moveme", 0, 0, 20); iwfShowGently("moveme", 5)'>reset orange box</a><br />\r
77                 <form action='iwfajaxpost.php' method='get' name='frmGet' iwfTarget='formSubmitResults'>\r
78                         <input type='hidden' value='hidden get value' name='hidValue' />\r
79                         <textarea name="textarea_content" cols="30" rows="2">sample text area content</textarea>\r
80                         <br/><input type="checkbox" name="checkbox_test" /> checkbox\r
81                         <br/><input type="radio" name="radio_test" value="first radio button"> first\r
82                         <br/><input type="radio" name="radio_test" value="second radio button"> second\r
83                         <br/>\r
84                         <input type='button' value='HTTP GET'  name='btnGet' onclick='javascript:iwfRequest(this);' />\r
85                         <a href='javascript:iwfRequest("frmGet")'> GET via anchor</a>\r
86                 </form>\r
87                 <form action='iwfajaxpost.php' method='post' id='frmPost' iwfTarget='formSubmitResults'>\r
88                         <input type='hidden' value='hidden post value' name='hidValue' />\r
89                         <textarea name="textarea_content" cols="30" rows="2">sample text area content</textarea>\r
90                         <br/><input type="checkbox" name="checkbox_test" /> checkbox\r
91                         <br/><input type="radio" name="radio_test" value="first radio button"> first\r
92                         <br/><input type="radio" name="radio_test" value="second radio button"> second\r
93                         <br/>\r
94                         <input type='button' value='HTTP POST'  name='btnPost' onclick='javascript:iwfRequest(this);' />\r
95                         <a href='javascript:iwfRequest("frmPost", "formSubmitResults")'> POST via anchor</a>\r
96                 </form>\r
97                 <p>\r
98                         <button onclick='javascript:iwfShowLog()'>Show IWF Log</button>\r
99                 </p>\r
100                 <div id='formSubmitResults' style='border:1px solid black;'>\r
101                         Results of form submittal should show up here.\r
102                 </div>\r
103                 <div id='iwfContent' style='border:3px solid blue; position:absolute;top:500px;left:100px;'>\r
104                         If they show up here, there is problems!  iwfTarget is not being recognized...\r
105                 </div>\r
106         </body>\r
107 </html>\r