实现无刷新加载数据(asp+ajax)
来源:互联网 发布:java activity 工作流 编辑:程序博客网 时间:2024/04/28 13:03
<div id="newphotos">数据载入中……</div>
<script language="JavaScript">
function getXML(URL){
if (window.XMLHttpRequest) { var xmlhttp = new XMLHttpRequest();
} else { var MSXML = ['MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP']; for(var n = 0; n < MSXML.length; n ++) { try { var xmlhttp = new ActiveXObject(MSXML[n]); break; } catch(e) { } } } xmlhttp.Open("GET", URL, false); try{ xmlhttp.Send(); var result = xmlhttp.status; } catch(e){ return(false); } if(result==200){ newphotos.innerHTML=unescape(xmlhttp.responseText); } var xmlhttp = null; }
function update(){ getXML('ajaxserver/newphoto.asp?placeid=<%= placeid %>&placecityid<%= placecityid %>'); }
setInterval("update()",1000);
</script>
asp文件
newphoto.asp
<!--#include file="include.asp" --> <% placeid=Request("placeid") placecityid=Request("placecityid")
xmlhttp="" xmlhttp=xmlhttp&"<table width=""99%"" height=""149"" border=""0"" align=""right"" cellpadding=""3"" cellspacing=""0"" class=""fuangkuanghs"">"&chr(13) xmlhttp=xmlhttp&"<tr>"&chr(13) xmlhttp=xmlhttp&"<td valign=""top""><table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"">"&chr(13) xmlhttp=xmlhttp&"<tr>"&chr(13) xmlhttp=xmlhttp&"<td height=""20"" align=""left"" class=""textblue""><table width=""396"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&chr(13) xmlhttp=xmlhttp&"<tr>"&chr(13) xmlhttp=xmlhttp&" <td width=""65%""><a href=""http://www.jiluyisheng.com/photo.asp?placeid="&placeid&"&placecityid="&placecityid&"""><img src=""images/index/index_01.jpg"" width=""349"" height=""23"" border=""0""></a></td>"&chr(13) xmlhttp=xmlhttp&"<td width=""35%""><a href=""http://www.jiluyisheng.com/photo.asp?placeid="&placeid&"&placecityid="&placecityid&""" target=""_self""><img src=""images/index/index_02.jpg"" width=""47"" height=""23"" border=""0""></a></td>"&chr(13) xmlhttp=xmlhttp&"</tr>"&chr(13) xmlhttp=xmlhttp&"</table>"&chr(13) xmlhttp=xmlhttp&"</td>"&chr(13) xmlhttp=xmlhttp&"</tr>"&chr(13) xmlhttp=xmlhttp&"<tr>"&chr(13) xmlhttp=xmlhttp&"<td valign=""top""><table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"">"&chr(13) xmlhttp=xmlhttp&"<tr>"&chr(13) set rs=userconn.execute("select top 3 weburl,photo_name,Photo_smallimg,idx_photo,jiuid,hits from v_jiphoto where weburl<>'' and iflag=2 and priv=1 "&where_str&" order by idx_photo desc") 'set rs=userconn.execute("select top 5 * from jiphoto where weburl<>'' and systype=5 order by idx_photo desc") if not rs.eof then
do while not rs.eof weburl=rs("weburl") if weburl<>"" then web= Replace(weburl,"http://","") picurl=weburl&"/Uploadfile/"&web& "/Photo/smallimg/" & rs("Photo_smallimg") else picurl="images/h3.gif" end if xmlhttp=xmlhttp&"<td height=""25"" align=""center""><table width=""99%"" border=""0"" cellpadding=""0"" cellspacing=""0"">"&chr(13) xmlhttp=xmlhttp&"<tr>"&chr(13) xmlhttp=xmlhttp&"<td height=""12"" align=""center""><table width=""123"" height=""93"" border=""1"" cellpadding=""3"" cellspacing=""0"" bordercolor=""#cccccc"" style=""BORDER-COLLAPSE: collapse"">"&chr(13) xmlhttp=xmlhttp&"<tr>"&chr(13) xmlhttp=xmlhttp&"<td width=""123"" height=""93"" align=""center""><a target=blank href="&weburl&"/photo.asp?idx_photo="&rs("idx_photo")&"&jiuid="&rs("jiuid")&"><img src="&picurl&" onload=""javascript:DrawImage(this,115,67)"" alt=""点击看大图"" width=""115"" height=""67"" border=""0""/></a> </td>"&chr(13) xmlhttp=xmlhttp&"</tr>"&chr(13) xmlhttp=xmlhttp&"</table>"&chr(13) xmlhttp=xmlhttp&"</td>"&chr(13) xmlhttp=xmlhttp&"</tr>"&chr(13) xmlhttp=xmlhttp&"<tr>"&chr(13) xmlhttp=xmlhttp&"<td height=""12"" align=""center"">"&FilterString(Rs("photo_name"),9)&"("& Rs("hits")&"/"&P.Get_RsCount(userconn,"[JiPhoto_reply]","idx_Photo="&rs("idx_photo"))&")</td>"&chr(13) xmlhttp=xmlhttp&"</tr>"&chr(13) xmlhttp=xmlhttp&"</table></td>"&chr(13) Rs.MoveNext loop end if rs.close() set rs=nothing xmlhttp=xmlhttp&"</tr>"&chr(13) xmlhttp=xmlhttp&"</table></td>"&chr(13) xmlhttp=xmlhttp&"</tr>"&chr(13) xmlhttp=xmlhttp&"</table></td>"&chr(13) xmlhttp=xmlhttp&"</tr>"&chr(13) xmlhttp=xmlhttp&"</table>"&chr(13) Response.write(escape(xmlhttp)) %>
- 实现无刷新加载数据(asp+ajax)
- AJAX实现无刷新加载数据
- ajax无刷新加载数据
- php+ajax实现无刷新动态加载数据技术
- php+ajax实现无刷新动态加载数据技术
- G Ajax无刷新分页加载数据
- JSON实现AJAX无刷新加载
- Asp+Ajax实现无刷新增加好友
- ASP.NET Ajax 实现无刷新分页
- XMlHTTP ajax实现数据无刷新调用
- Ajax无刷新实现定时更新数据
- AJAX实现无刷新获得数据
- php+ajax实现无刷新动态加载数据技术 - 测试用了,效果还行
- asp+ajax能实现根据下拉列表值动态无刷新显示数据
- ASP.NET+Ajax+JQuey+Json数据+存储过程实现无刷新分页
- thinkphp+ajax 移动端实现滚动到底部加载数据(无刷新动态加载数据技术的应用)
- ajax无刷新加载原理
- Ajax+dtree实现动态加载无刷新树
- 教你理解复杂的C/C++声明
- 新浪&CSDN博客访问量比较
- 网站二级域名用asp.net 2.0的实现方案
- 获得数据库自动产生主键
- WinForm中Component Class、User Control及Custom Control的区别和使用建议
- 实现无刷新加载数据(asp+ajax)
- 在线播放器代码大全
- 在struts中html:select 标签的disabled属性中使用java代码
- 转载:mysql+linux
- 漫谈国际化和本地化测试
- SQL语句导入导出大全
- flash动态加载FLV时遇到的问题
- 简单介绍:MS-SQL数据库开发常用汇总
- VC中建立模态对话框和非模态对话框