OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <title>Testing Alerts</title> | |
4 | |
5 <script type="text/javascript"> | |
6 function setInnerText(id, value) { | |
7 document.getElementById(id).innerHTML = '<p>' + value + '</p>'; | |
8 } | |
9 | |
10 function displayPrompt() { | |
11 setInnerText('text', prompt('Enter something')); | |
12 } | |
13 | |
14 function displayPromptWithDefault() { | |
15 setInnerText('text', prompt('Enter something', 'This is a default valu
e')); | |
16 } | |
17 | |
18 function displayTwoPrompts() { | |
19 setInnerText('text1', prompt('First')); | |
20 setInnerText('text2', prompt('Second')); | |
21 } | |
22 | |
23 function slowAlert() { | |
24 window.setTimeout(function() { | |
25 alert('Slow'); | |
26 }, 200); | |
27 } | |
28 </script> | |
29 </head> | |
30 <body> | |
31 | |
32 <h1>Testing Alerts and Stuff</h1> | |
33 | |
34 <p>This tests alerts: <a href="#" id="alert" onclick="alert('cheese');">click me
</a></p> | |
35 | |
36 <p>This tests alerts: <a href="#" id="empty-alert" onclick="alert('');">click me
</a></p> | |
37 | |
38 <p>Let's make the <a href="#" id="prompt" onclick="displayPrompt();">prompt happ
en</a></p> | |
39 | |
40 <p>Let's make the <a href="#" id="prompt-with-default" onclick="displayPromptWit
hDefault();">prompt with default happen</a></p> | |
41 | |
42 <p>Let's make TWO <a href="#" id="double-prompt" onclick="displayTwoPrompts();">
prompts happen</a></p> | |
43 | |
44 <p>A <a href="#" id="slow-alert" onclick="slowAlert();">SLOW</a> alert</p> | |
45 | |
46 <p>This is a test of a confirm: | |
47 <a href="simpleTest.html" id="confirm" onclick="return confirm('Are you sure
?');">test confirm</a></p> | |
48 | |
49 <p>This is a test of showModalDialog: <a href="#" id="dialog" onclick="showModal
Dialog('javascriptPage.html')">test dialog</a></p> | |
50 | |
51 <p>This is a test of an alert in an iframe: | |
52 <iframe src="iframeWithAlert.html" name="iframeWithAlert"></iframe> | |
53 </p> | |
54 | |
55 <p>This is a test of an alert in a nested iframe: | |
56 <iframe src="iframeWithIframe.html" name="iframeWithIframe"></iframe> | |
57 </p> | |
58 | |
59 <p>This is a test of an alert open from onload event handler: <a id="open-page-w
ith-onload-alert" href="pageWithOnLoad.html">open new page</a></p> | |
60 | |
61 <p>This is a test of an alert open from onload event handler: <a id="open-window
-with-onload-alert" href="pageWithOnLoad.html" target="onload">open new window</
a></p> | |
62 | |
63 <p>This is a test of an alert open from onunload event handler: <a id="open-page
-with-onunload-alert" href="pageWithOnUnload.html">open new page</a></p> | |
64 | |
65 <p>This is a test of an alert open from onclose event handler: <a id="open-windo
w-with-onclose-alert" href="pageWithOnUnload.html" target="onclose">open new win
dow</a></p> | |
66 | |
67 <p>This is a test of an alert open from onclose event handler: <a id="open-new-w
indow" href="blank.html" target="newwindow">open new window</a></p> | |
68 | |
69 <div id="text"></div> | |
70 <div id="text1"></div> | |
71 <div id="text2"></div> | |
72 </body> | |
73 </html> | |
OLD | NEW |