本站首页    管理页面    写新日志    退出


«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告
 本博客在此声明所有文章均为转摘,只做资料收集使用。

我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:
日志总数:1304
评论数量:2242
留言数量:5
访问次数:7587795
建立时间:2006年5月29日




[Prototype(Ajax)]利用ajax实现实施刷新
软件技术

lhwork 发表于 2006/10/17 10:01:53

很多应用都有实施刷新的需求,用 html 或 javascript 的刷新方式都是全局刷新,客户能够明显感觉到闪动。介绍种 ajax 实现在实施刷新技术。   使用 xmlhttp.htm 实时刷新,访问 http://127.0.0.1:7001/xmlhttp.jsp 页面,由 xmlhttp.jsp 页面写入随机数。 500)this.width=500'> < html >  500)this.width=500'> < head >< title > test </ title >  500)this.width=500'> < script language = " javascript " >  500)this.width=500'>function detect()500)this.width=500'>500)this.width=500'> 500)this.width=500'> { 500)this.width=500'>    xml  =   new  ActiveXObject( " Microsoft.XMLHTTP " ); 500)this.width=500'>    var post = "   " ; 500)this.width=500'>    xml.open( " POST " , " http://127.0.0.1:7001/xmlhttp.jsp " , false );500)this.width=500'>    xml.setrequestheader( " content-length " ,post.length); 500)this.width=500'>    xml.setrequestheader( " content-type " , " application/x-www-form-urlencoded " ); 500)this.width=500'>    xml.send(post); 500)this.width=500'>    var res  =  xml.responseText; 500)this.width=500'>    list.innerText = res; 500)this.width=500'>     // 设置自动刷新时间 500)this.width=500'>     setTimeout( " detect() " , 1000 ); 500)this.width=500'>}  500)this.width=500'> </ script >  500)this.width=500'> < body onload = " detect() " > 500)this.width=500'>test : 500)this.width=500'>     < a id = " list " ></ a >  500)this.width=500'> </ body >  500)this.width=500'> </ html > 500)this.width=500'> xmlhttp.jsp 利用随机数测试 500)this.width=500'> <% @ page  import = " java.util.Random " %> 500)this.width=500'> <% @ page language = " java "  contentType = " text/html;charset=gb2312 " %> 500)this.width=500'> <% 500)this.width=500'>    Random random = new  Random();500)this.width=500'>    out.println(random.nextInt());500)this.width=500'> %> 500)this.width=500'>


阅读全文(3037) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.063 second(s), page refreshed 144766409 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号