3 <title>Testing Alerts
</title>
5 <script type=
"text/javascript">
6 function setInnerText(id
, value
) {
7 document
.getElementById(id
).innerHTML
= '<p>' + value
+ '</p>';
10 function displayPrompt() {
11 setInnerText('text', prompt('Enter something'));
14 function displayPromptWithDefault() {
15 setInnerText('text', prompt('Enter something', 'This is a default value'));
18 function displayTwoPrompts() {
19 setInnerText('text1', prompt('First'));
20 setInnerText('text2', prompt('Second'));
23 function slowAlert() {
24 window
.setTimeout(function() {
32 <h1>Testing Alerts and Stuff
</h1>
34 <p>This tests alerts:
<a href=
"#" id=
"alert" onclick=
"alert('cheese');">click me
</a></p>
36 <p>This tests alerts:
<a href=
"#" id=
"empty-alert" onclick=
"alert('');">click me
</a></p>
38 <p>Let's make the
<a href=
"#" id=
"prompt" onclick=
"displayPrompt();">prompt happen
</a></p>
40 <p>Let's make the
<a href=
"#" id=
"prompt-with-default" onclick=
"displayPromptWithDefault();">prompt with default happen
</a></p>
42 <p>Let's make TWO
<a href=
"#" id=
"double-prompt" onclick=
"displayTwoPrompts();">prompts happen
</a></p>
44 <p>A
<a href=
"#" id=
"slow-alert" onclick=
"slowAlert();">SLOW
</a> alert
</p>
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>
49 <p>This is a test of showModalDialog:
<a href=
"#" id=
"dialog" onclick=
"showModalDialog('javascriptPage.html')">test dialog
</a></p>
51 <p>This is a test of an alert in an iframe:
52 <iframe src=
"iframeWithAlert.html" name=
"iframeWithAlert"></iframe>
55 <p>This is a test of an alert in a nested iframe:
56 <iframe src=
"iframeWithIframe.html" name=
"iframeWithIframe"></iframe>
59 <p>This is a test of an alert open from onload event handler:
<a id=
"open-page-with-onload-alert" href=
"pageWithOnLoad.html">open new page
</a></p>
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>
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>
65 <p>This is a test of an alert open from onclose event handler:
<a id=
"open-window-with-onclose-alert" href=
"pageWithOnUnload.html" target=
"onclose">open new window
</a></p>
67 <p>This is a test of an alert open from onclose event handler:
<a id=
"open-new-window" href=
"blank.html" target=
"newwindow">open new window
</a></p>
70 <div id=
"text1"></div>
71 <div id=
"text2"></div>