<
script
>
setInterval(
"
refreshTime()
"
,
1000
);
//
每格1秒刷新一次
funciton refreshTime()
{
var
dateObj
=
new
Date();
time.innerHTML
=
dateObj.toLocaleDateString();
//
刷新div里面的内容
}
</
script
>
<
div id
=
time
></
div
>
function
doRef()
{
var
url
=
"
xxx.asp?a=1&b=2
"
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 ;
//
如果出现编码问题,可以在服务端escape一下,然后在这里使用unescape( responseText )
theDiv.innerHTML
=
theDate ;
}
}
setInterval( doRef ,
1000
) ;
posted on 2008-06-05 15:04
无声 阅读(5725)
评论(8) 编辑 收藏 所属分类:
职场生活