-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
339 lines (280 loc) · 10.2 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
<?php
// http/extra.topology.org/jstest/index.php 2017-12-17 Alan U. Kennington.
// $Id: http/extra.topology.org/jstest/index.php fb55e22ffb 2017-12-13 16:07:14Z Alan U. Kennington $
echo("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html lang=\"en\"><head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
<meta http-equiv=\"Content-Style-Type\" content=\"text/css\">
<meta name=\"robots\" content=\"noindex,nofollow,noarchive\">
<style type=\"text/css\"><!--
blockquote { color:#000000; background-color:#eeffde;
border-width:1px; border-style:dotted; text-align:left; padding:3px; }
body { font-family:arial,sans-serif,helvetica; }
pre { color:#000000; background-color:#eeffde;
border-width:1px; border-style:dotted;
margin-left:5px; margin-right:5px; text-align:left; padding:3px; }
pre.plain { background-color:transparent; border-style:none; }
table.main1 { padding:0px; margin:1px; }
table.main2 { padding:0px; margin:1px; }
table.main3 { padding:0px; margin:0px; white-space:nowrap; }
td, th { padding-left:3pt; padding-right:3pt; }
--></style>
<title>javascript test 1</title>
<script>\"use strict\";</script>
<script src=\"jstest1.js\"></script>
</head>
<body onload=\"body_onload();\" onunload=\"body_onunload();\">
<center>
<span style=\"font-size:160%;\">javascript test 1<br></span>
</center>
");
//-----------------------------------------------------------------------------
echo("
<span id=\"js_okay\">Javascript is off.<br>
This web page is probably more interesting if you turn Javascript on.</span><br>
<br>
Properties of your browser:<br>
<table class=\"main3\" cellspacing=0 cellpadding=0>
<tr>
<td>Code name:</td>
<td><span id=\"js_appCodeName\"></span></td>
</tr>
<tr>
<td>App name:</td>
<td><span id=\"js_appName\"></span></td>
</tr>
<tr>
<td>App version:</td>
<td><span id=\"js_appVersion\"></span></td>
</tr>
<tr>
<td>Cookie enabled:</td>
<td><span id=\"js_cookieEnabled\"></span></td>
</tr>
<tr>
<td>Geolocation:</td>
<td><span id=\"js_geolocation\"></span></td>
</tr>
<tr>
<td>Language:</td>
<td><span id=\"js_language\"></span></td>
</tr>
<tr>
<td>On line:</td>
<td><span id=\"js_onLine\"></span></td>
</tr>
<tr>
<td>Platform:</td>
<td><span id=\"js_platform\"></span></td>
</tr>
<tr>
<td>Product:</td>
<td><span id=\"js_product\"></span></td>
</tr>
<tr>
<td>User agent:</td>
<td><span id=\"js_userAgent\"></span></td>
<tr>
<td>Java enabled:</td>
<td><span id=\"js_javaEnabled\"></span></td>
</tr>
</table>
(There seems to be no direct way to determine the Javascript version.)<br>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<p><hr>
Properties of your computer screen:<br>
Screen dimensions set when this web page has been loaded:<br>
<span id=\"wh_screen2\">screen w/h</span><br>
<br>
Click <q>set screen w/h</q> to replace <q>screen w/h</q> with dynamic screen
width/height.<br>
<button type=\"button\" onclick='set_wh();'>set screen w/h</button>
<span id=\"wh_screen\">screen w/h</span><br>
(This is almost pointless because the screen dimensions are fixed usually.<br>
On the other hand, there are some ways to adjust the perceived screen size.)<br>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<p><hr>
Properties of your browser window:<br>
Window dimensions: <span id=\"wh_window2\">window w/h</span><br>
<br>
Window property list:
<button type=\"button\"
onclick='document.getElementById(\"window_props\").innerHTML =
\"<br>\" + window_prop_list();'>show</button>
<button type=\"button\"
onclick='document.getElementById(\"window_props\").innerHTML =
\"<br>\";'>hide</button>
<span id=\"window_props\"><br></span>
<br>
Window-document property list:
<button type=\"button\"
onclick='document.getElementById(\"window_doc_props\").innerHTML =
\"<br>\" + window_doc_prop_list();'>show</button>
<button type=\"button\"
onclick='document.getElementById(\"window_doc_props\").innerHTML =
\"<br>\";'>hide</button>
<span id=\"window_doc_props\"><br></span>
<br>
Current geometry of the window after a <q>resize</q>:<br>
<span id=\"handler_resize_out\">To test this, resize the current window.</span>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<p><hr>
Click the following button to test the alert-button pop-up.<br>
<button type=\"button\" onclick='alert(\"alert button\");'>alert button
test</button><br>
<br>
Click the following button to test the confirm-button pop-up.<br>
<button type=\"button\" onclick='confirm_test();'>confirm-button
test</button><br>
confirm-test output: <span id=\"confirm1output\"></span><br>
<br>
Click the following button to test the prompt-button pop-up.<br>
<button type=\"button\" onclick='prompt_test();'>prompt-button test</button><br>
prompt-test output: <span id=\"prompt1output\"></span><br>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<p><hr>
<button type=\"button\"
onclick='document.getElementById(\"text1\").innerHTML
= \"changed text 1\";'>change text 1</button>
<button type=\"button\"
onclick='document.getElementById(\"text1\").innerHTML
= \"original text 1\";'>restore text 1</button>
<br>
<span id=\"text1\">original text 1</span><br>
<button type=\"button\"
onclick='document.getElementById(\"text1\").style.fontSize = \"10px\";'>text 1
font = 10px</button>
<button type=\"button\"
onclick='document.getElementById(\"text1\").style.fontSize = \"20px\";'>text 1
font = 20px</button>
<br>
<button type=\"button\"
onclick='document.getElementById(\"text1\").style.color=\"red\";'>text 1 colour
= red</button>
<button type=\"button\"
onclick='document.getElementById(\"text1\").style.color=\"green\";'>text 1
colour = green</button>
<button type=\"button\"
onclick='document.getElementById(\"text1\").style.color=\"black\";'>text 1
colour = black</button>
<br>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<p><hr>
<span id=\"date1\">date 1</span><br>
<button type=\"button\" onclick='document.getElementById(\"date1\").innerHTML =
escapeHTML(Date());'>set date 1</button>
(reset by each click)<br>
<span id=\"dateUTC\">date UTC</span><br>
<button type=\"button\" onclick='document.getElementById(\"dateUTC\").innerHTML
= escapeHTML(date0.toUTCString());'>set date UTC</button>
(set once at beginning of script)<br>
<button type=\"button\"
onclick='this.innerHTML=escapeHTML(Date());'>get date</button><br>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<p><hr>
<button type=\"button\"
onmouseover='mouseOverCount1 += 1;
this.innerHTML=\"mouse over count = \" + String(mouseOverCount1) +
\", mouse out count = \" + String(mouseOutCount1);'
onmouseout='mouseOutCount1 += 1;
this.innerHTML=\"mouse over count = \" + String(mouseOverCount1) +
\", mouse out count = \" + String(mouseOutCount1);'
>test mouse-over</button><br>
<button type=\"button\"
onkeydown='keyDownCount1 += 1;
this.innerHTML=\"key-down count = \" + String(keyDownCount1);'
>test key-down (first click on button)</button><br>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<p><hr>
Test slices (2, 4) and (−4, −2) of the string <q>0123456789</q>:<br>
<button type=\"button\"
onclick='test_slice();'>test slice (should give 23 and 67)</button><br>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<p><hr>
Test a form-validation function.<br>
<form
name=\"form1\"
action=\"form1.php\"
onsubmit=\"return form1valid();\"
method=\"post\">
Field 1: <input type=\"text\" name=\"field1\"> must be non-empty<br>
Field 2: <input type=\"text\" name=\"field2\"> must be non-empty<br>
<input type=\"submit\" value=\"Submit\">
</form>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<p><hr>
Test the limits from 1 to 12 for a numerical input.<br>
Returns empty string with Opera 12.16 (2013).<br>
Returns meaningful error message with:
Chrome 12.0.742.112 (2011),
Firefox 57.0.1 (2017).<br>
<input id=\"input1\" type=\"number\" min=\"1\" max=\"12\" required>
<button onclick=\"input1check()\">Enter</button><br>
Output: <span id=\"input1output\">[not yet set]</span><br>
Validity: <span id=\"input1validity\">[not yet set]</span><br>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<p><hr>
Tree of HTML elements below the <q>body</q> element.
<button type=\"button\"
onclick='document.getElementById(\"id_tree_body\").innerHTML =
get_tree_body() + \"<br>\";'>show</button>
<button type=\"button\"
onclick='document.getElementById(\"id_tree_body\").innerHTML =
\"\";'>hide</button>
<br>
<span id=\"id_tree_body\"></span>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<p><hr>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<script>
// Global variables.
var mouseOverCount1 = 0;
var mouseOutCount1 = 0;
var keyDownCount1 = 0;
var date0 = new Date();
// Get screen dimensions.
var screen0 = {
w: screen.availWidth,
h: screen.availHeight,
d: screen.colorDepth,
total_w: screen.width,
total_h: screen.height,
pd: screen.pixelDepth
};
// Code to modify an element must be run after the element has appeared.
document.getElementById(\"wh_screen2\").innerHTML =
\"w = \" + String(screen0.w) +
\", h = \" + String(screen0.h) +
\", d = \" + String(screen0.d) +
\", total_w = \" + String(screen0.total_w) +
\", total_h = \" + String(screen0.total_h) +
\", pd = \" + String(screen0.pd);
// The following line does nothing on my Opera browser.
// console.log(date0);
// Get window dimensions.
var window0 = {
iw: window.innerWidth,
ih: window.innerHeight,
ow: window.outerWidth,
oh: window.outerHeight
};
// Code to modify an element must be run after the element has appeared.
document.getElementById(\"wh_window2\").innerHTML =
\"inner: w = \" + String(window0.iw) +
\", h = \" + String(window0.ih) +
\"; outer: w = \" + String(window0.ow) +
\", h = \" + String(window0.oh);
// Make a field show the current window dimensions.
// Use kludge for handling versionitis.
if (window.addEventListener) {
window.addEventListener(\"resize\", handler_resize);
}
else {
document.getElementById(\"handler_resize_out\").innerHTML =
\"window.addEventListener is undefined<br>\";
}
</script>
");
//-----------------------------------------------------------------------------
echo("\n</body></html>\n");
?>