HTML code
1 <% @ page Language = "C #" autoeventwireup = "true" codefile = "default. aspx. cs" inherits = "_ default" %>
2
3 <! Doctype HTML public "-// W3C // dtd xhtml 1.1 // en" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <HTML xmlns = "http://www.w3.org/1999/xhtml">
5 6 <title> untitled page </title>
7 <script language = "JavaScript" type = "text/JavaScript">
8 function Hello ()
9 {
10 beginmessage ();
11 var T = setTimeout ("endmessage ('timing ends 5 seconds! ') ", 5000)
12}
13 function endmessage (MSG)
14 {
15 pagemethods. MSG (MSG, updatemessages );
16}
17 function beginmessage ()
18 {
19 pagemethods. MSG ("Start time", updatemessages );
20}
21 function updatemessages (result)
22 {
23 $ get ("LBL"). innerhtml = result;
24}
25 </SCRIPT>
26 27 <body>
28 <Form ID = "form1" runat = "server">
29 <asp: scriptmanager id = "scriptmanager1" enablepagemethods = "true" runat = "server"/>
30 <div>
31 <asp: Label id = "LBL" runat = "server" text = "label"> </ASP: Label
32> <input id = "button1" type = "button"
33 value = "start" onclick = "Hello ()"/>
34 </div>
35 </form>
36 </body>
37 38
Background code
Default. aspx. CS
Using system;
Using system. Data;
Using system. configuration;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. Web. UI. htmlcontrols;
Using system. Web. Services;
Public partial class _ default: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{
}
[Webmethod]
Static Public String MSG (string MSG)
{
Return MSG;
}
}