在线等!100分求jquery 中有setinterval的问题!!

lzc2009 2010-02-28 04:52:41
在线等!100分求jquery 中有setinterval的问题!!

艾恩AJAX聊天室
http://wuhan333.cn/

他代码里有这样一句

var id1=0;
$(document).ready(function(){
getMessage();
id1=window.setInterval("getMessage()",1000);
});

function getMessage(){
var sendUrl="rnd=" + Math.random();
$.ajax({
type : "post",
async : true,
url : "getMessage.asp",
data : sendUrl,
success : function(msg){
if(msg!=lastMsg){
lastMsg=msg;
$("#content").html(msg);
window.document.title="【有新消息】-艾恩AJAX聊天室!";
play();
$("#span1").html("");
}
if(scroll){
$("#content").scrollTop(2000);
}
},
error : function(){
$("#span1").html("<img src='img/loading.gif' alt='' />");
}
});
return true;
}


明显是每2秒中调用了getMessage这个方法,但是它鼠标并没有出现“漏斗”的那个东西,在IE最下边,也没显示刷新的目标,请问是怎么做到的?我为什么也用JQUERY这样写就做不到呢?

我的程序



var time1=null;
$(document).ready(function(){
zt();
//time1=window.setInterval("zt()",2000);

});

function zt(){
$.get("zt.asp?randID="+Math.random(), function(data){
$("#zt").html(data);
});
}



我写上这句鼠标就疯狂的闪啊!!如果返回的数据里有动态图片的,图片也会重新从头开始变化~

来人帮忙看下,他是怎么做到的?
...全文
250 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lure2222 2010-02-28
  • 打赏
  • 举报
回复
引用 2 楼 sohighthesky 的回复:
JScript codeif(msg!=lastMsg){
lastMsg=msg;


正确!!!接分了啊!!楼主来分
lzc2009 2010-02-28
  • 打赏
  • 举报
回复
if(msg!=lastMsg){
lastMsg=msg;


这句吗》??

他写的是
var lastMsg=""

这句是什么意思,传回的值非空则 传回值付给lastMsg就行了?能解释下吗?我试试去
sohighthesky 2010-02-28
  • 打赏
  • 举报
回复
if(msg!=lastMsg){
lastMsg=msg;
lzc2009 2010-02-28
  • 打赏
  • 举报
回复
没有人会吗》?????

87,922

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧