Default.aspx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head id="Head1" runat="server">
  4. <title>Untitled Page</title>
  5. </head>
  6. <body>
  7. <form id="form1" name="form1" runat="server">
  8. <h2>Sys.Debug Methods Test Page</h2>
  9. <asp:ScriptManager ID="ScriptManager1"
  10. runat="server" />
  11. <p><b>Use these buttons to demonstrate the assert() and fail()
  12. methods:</b><br />
  13. <input id="btnAssert" type="button" value="Assert"
  14. style="width: 100px"
  15. onclick="return btnAssert_onclick()" /> &nbsp
  16. <input id="btnFail" type="button" value="Fail"
  17. style="width: 100px" onclick="return btnFail_onclick()" />
  18. </p><hr />
  19. <b>Use the textbox and buttons below to demonstrate tracing.</b>
  20. <br />
  21. <p>Enter your name here:<br />
  22. <input id="text1" maxlength="50" type="text" />
  23. <br />
  24. <br />
  25. <input id="btnTrace" type="button" value="Trace"
  26. style="width: 100px" onclick="return btnTrace_onclick()" /><br />
  27. <input id="btnDump" type="button" value="TraceDump"
  28. style="width: 100px" onclick="return btnDump_onclick()" /><br />
  29. <input id="btnClear" type="button" value="ClearTrace"
  30. style="width: 100px" onclick="return btnClear_onclick()" /><br />
  31. <br /></p>
  32. View output in the TraceConsole textarea below.
  33. <br />
  34. <textarea id='TraceConsole' rows="10" cols="50"
  35. title="TraceConsole"></textarea>
  36. </form>
  37. <script language="javascript" type="text/javascript">
  38. function btnAssert_onclick() {
  39. var n;
  40. // Insert code intended to set n to a positive integer.
  41. if (false) n = 3;
  42. // Assert if n is not greater than 0.
  43. Sys.Debug.assert(n > 0, "n must be set to a positive integer.");
  44. }
  45. function btnFail_onclick() {
  46. var n;
  47. // Insert code intended to set n to a numeric value.
  48. if (false) n = 3;
  49. // Fail if n is not numeric.
  50. if (isNaN(n)) Sys.Debug.fail("The value of n must be a number.");
  51. }
  52. function btnTrace_onclick() {
  53. v = theForm.text1.value;
  54. Sys.Debug.trace("Name set to " + "\"" + v + "\".");
  55. alert("Hello " + v + ".");
  56. }
  57. function btnDump_onclick() {
  58. Sys.Debug.traceDump(theForm.text1, "Name textbox");
  59. alert("Hello " + theForm.text1.value + ".");
  60. }
  61. function btnClear_onclick() {
  62. Sys.Debug.clearTrace()
  63. alert("Trace console cleared.");
  64. }
  65. </script>
  66. </body>
  67. </html>