alerts.html 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <html>
  2. <!-- Padding to account for small screens of mobile devices -->
  3. <style>
  4. p {margin-top:48px;}
  5. </style>
  6. <head>
  7. <title>Testing Alerts</title>
  8. <script type="text/javascript">
  9. function setInnerText(id, value) {
  10. document.getElementById(id).innerHTML = '<p>' + value + '</p>';
  11. }
  12. function displayPrompt() {
  13. setInnerText('text', prompt('Enter something'));
  14. }
  15. function displayPromptWithDefault() {
  16. setInnerText('text', prompt('Enter something', 'This is a default value'));
  17. }
  18. function displayTwoPrompts() {
  19. setInnerText('text1', prompt('First'));
  20. setInnerText('text2', prompt('Second'));
  21. }
  22. function slowAlert() {
  23. window.setTimeout(function() {
  24. alert('Slow');
  25. }, 200);
  26. }
  27. </script>
  28. </head>
  29. <body>
  30. <h1>Testing Alerts and Stuff</h1>
  31. <p>This tests alerts: <a href="#" id="alert" onclick="alert('cheese');">click me</a></p>
  32. <p>This tests alerts: <a href="#" id="empty-alert" onclick="alert('');">click me</a></p>
  33. <p>Let's make the <a href="#" id="prompt" onclick="displayPrompt();">prompt happen</a></p>
  34. <p>Let's make the <a href="#" id="prompt-with-default" onclick="displayPromptWithDefault();">prompt with default happen</a></p>
  35. <p>Let's make TWO <a href="#" id="double-prompt" onclick="displayTwoPrompts();">prompts happen</a></p>
  36. <p>A <a href="#" id="slow-alert" onclick="slowAlert();">SLOW</a> alert</p>
  37. <p>This is a test of a confirm:
  38. <a href="simpleTest.html" id="confirm" onclick="return confirm('Are you sure?');">test confirm</a></p>
  39. <p>This is a test of showModalDialog: <a href="#" id="dialog" onclick="showModalDialog('javascriptPage.html')">test dialog</a></p>
  40. <p>This is a test of an alert in an iframe:
  41. <iframe src="iframeWithAlert.html" name="iframeWithAlert"></iframe>
  42. </p>
  43. <p>This is a test of an alert in a nested iframe:
  44. <iframe src="iframeWithIframe.html" name="iframeWithIframe"></iframe>
  45. </p>
  46. <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>
  47. <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>
  48. <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>
  49. <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>
  50. <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>
  51. <div id="text"></div>
  52. <div id="text1"></div>
  53. <div id="text2"></div>
  54. <p><select id="select" onchange="alert('changed');">
  55. <option id="novalue" value="">Nothing selected</option>
  56. <option id="value1" value="1">One</option>
  57. <option id="value2" value="2">Two</option>
  58. <option id="value3" value="3">Three</option>
  59. </select></p>
  60. <p><input id="input" onchange="alert('change fired');" value="onchange"/></p>
  61. </body>
  62. </html>