default.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> <mce:script language="javascript" type="text/javascript" src="js/jquery-1.2.6-vsdoc-cn.js" mce_src="js/jquery-1.2.6-vsdoc-cn.js"></mce:script> <mce:script language="javascript" type="text/javascript" ><!-- function Button1_Click() { AutoRefresh(); } function getData() { $(document).ready(function() { $("#<%=lbl_count.ClientID %>").load("Handler.ashx", { "resultType": "text" }); }); } function AutoRefresh() { setInterval("getData()",1000); } // --></mce:script> </head> <body> <form id="form1" runat="server"> <strong>JQuery无刷新演示<br /> </strong> <asp:Label ID="lbl_count" runat="server"></asp:Label><br/> <input type="button" οnclick="Button1_Click()" value="无刷新演示" /> </form> </body> </html> Handler.ashx <%@ WebHandler Language="C#" Class="Handler" %> using System; using System.Web; using System.Collections; public class Handler : IHttpHandler { public void ProcessRequest (HttpContext context) { Hashtable ht = new Hashtable(); string show = ""; context.Response.ContentType = "text/plain"; context.Response.Write("<font color=red>刷新的时间是:"+DateTime.Now.ToString()+"</font>"); } public bool IsReusable { get { return false; } } } 转帖请注明