ServerTime.aspx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <%@ Page Language="C#" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head id="Head1" runat="server">
  5. <style type="text/css">
  6. body { font: 11pt Trebuchet MS;
  7. font-color: #000000;
  8. padding-top: 72px;
  9. text-align: center }
  10. .text { font: 8pt Trebuchet MS }
  11. </style>
  12. <title>Simple Web Service</title>
  13. <script type="text/javascript">
  14. // This function calls the Web Service method.
  15. function GetServerTime()
  16. {
  17. Samples.AspNet.ServerTime.GetServerTime(OnSucceeded);
  18. }
  19. // This is the callback function that
  20. // processes the Web Service return value.
  21. function OnSucceeded(result)
  22. {
  23. var RsltElem = document.getElementById("Results");
  24. RsltElem.innerHTML = result;
  25. }
  26. </script>
  27. </head>
  28. <body>
  29. <form id="Form1" runat="server">
  30. <asp:ScriptManager runat="server" ID="scriptManager">
  31. <Services>
  32. <asp:ServiceReference path="ServerTime.asmx" />
  33. </Services>
  34. </asp:ScriptManager>
  35. <div>
  36. <h2>Server Time</h2>
  37. <p>Calling a service that returns the current server time.</p>
  38. <input id="EchoButton" type="button"
  39. value="GetTime" onclick="GetServerTime()" />
  40. </div>
  41. </form>
  42. <hr/>
  43. <div>
  44. <span id="Results"></span>
  45. </div>
  46. </body>
  47. </html>