Ajax partial refresh instance (recommended in three ways), ajax instance
Ajax partial refresh
<Script> setInterval ("refreshTime ()", 1000); // refresh funciton refreshTime () {var dateObj = new Date (); time every second. innerHTML = dateObj. toLocaleDateString (); // refresh the content in the div} </script> <div id = time> </div>
Function doRef () {var url = "xxx. aspx "var dateRequest = new ActiveXObject (" Microsoft. XMLHTTP "); dateRequest. abort (); dateRequest. open ("GET", url, true); dateRequest. onreadystatechange = onSendSelf; dateRequest. send (); function onSendSelf () {if (dateRequest. readyState! = 4) {return;} var theDate = dateRequest. responseText; // If the encoding problem occurs, you can log on to the escape server and use unescape (responseText) theDiv here. innerHTML = theDate ;}} setInterval (doRef, 1000); // refresh once every 1 second, a little faster
<form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <br /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick"> </asp:Timer> <asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox> </ContentTemplate> </asp:UpdatePanel> </form>
===== Add the timerjavastick event in the background
// Interval = "1000" indicates the Interval for refreshing.
TextBox1.Text = DateTime. Now
You can see it.
The above ajax partial refresh instance (recommended in three ways) is all the content shared by Alibaba Cloud xiaobian. I hope you can give us a reference and support for the help house.