- 爱易网页
-
ASP教程
- 如何实现无刷新更新数据呢,就是那种不闪烁的自动刷新
日期:2014-05-17 浏览次数:21354 次
怎么实现无刷新更新数据呢,就是那种不闪烁的自动刷新
我用asp页面显示数据库表中的内容,想能不闪烁的自动刷新。
看了半天文章也没有弄懂,干脆麻烦大虾帮我加上吧。
下面给出了我得页面例子。比如5秒钟刷新一次。
<%@ Language=VBScript%>
<% Response.Expires=0%>
<% Response.Buffer=TRUE%>
<!--#include file= "conn.asp "-->
<%
'dim conn
set Conn = GetConn()
%>
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> </title>
<link href= "css.css " rel= "stylesheet " type= "text/css ">
</head>
<body>
<%
set rs = server.CreateObject( "adodb.recordset ")
sql = "SELECT * FROM smp_web_client order by lid desc "
rs.open sql,conn,1,1
%>
<table width= "98% " border= "0 " cellpadding= "5 " cellspacing= "1 " bgcolor= "#C3D1F5 " ID= "Table1 ">
<tr>
<td align= "center " valign= "middle " bgcolor= "#89C4F3 "> 序号 </td>
<td align= "center " valign= "middle " bgcolor= "#89C4F3 "> 号码1 </td>
<td align= "center " valign= "middle " bgcolor= "#89C4F3 "> 号码2 </td>
<td align= "center " valign= "middle " bgcolor= "#89C4F3 "> 时间 </td>
</tr>
<%
rows=1
if rs.RecordCount <> 0 then
rs.AbsolutePage=session( "currentpage ")
end if
while not rs.EOF and rows <=rs.PageSize
if rows mod 2 then %>
<tr>
<td align= "center " valign= "middle " bgcolor= "#FFFFFF "> <%=rs( "id ")%> </td>
<td align= "center " valign= "middle " bgcolor= "#FFFFFF "> <%=rs( "num1 ")%> </td>
<td align= "center " valign= "middle " bgcolor= "#FFFFFF "> <%=rs( "num2 ")%> </td>
<td align= "center " valign= "middle " bgcolor= "#FFFFFF "> <%=rs( "date ")%> </td>
</tr>
<%else%>
<tr>
<td align= "center " valign= "middle " bgcolor= "#E7F1FA "> <%=rs( "id ")%> </td>
<td align= "center " valign= "middle " bgcolor= "#E7F1FA "> <%=rs( "num1 ")%> </td>
<td align= "center " valign= "middle " bgcolor= "#E7F1FA "> <%=rs( "num2 ")%> </td>
<td align= "center " valign= "middle " bgcolor= "#E7F1FA "> <%=rs( "date ")%> </td>
</tr>
<%end if%>
<%
rs.MoveNext
rows=rows+1
wend
%>