HTML代码
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
<head runat="server">
6
<title>Untitled Page</title>
7
<script language="javascript" type="text/javascript">
8
function hello()
9
{
10
BeginMessage();
11
var t=setTimeout("endMessage('计时结束 5 seconds!')",5000)
12
}
13
function endMessage(msg)
14
{
15
PageMethods.Msg(msg,updateMessages);
16
}
17
function BeginMessage()
18
{
19
PageMethods.Msg("计时开始",updateMessages);
20
}
21
function updateMessages(result)
22
{
23
$get("lbl").innerHTML =result;
24
}
25
</script>
26
</head>
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="开始" onclick="hello()" />
34
</div>
35
</form>
36
</body>
37
</html>
38

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

后台代码
