使用javascript自动刷新div [英] auto refresh a div using javascript

查看:936
本文介绍了使用javascript自动刷新div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现状我正在尝试自动刷新Joomla 2.5中的文章中定义的标签

SITUATION I am trying to auto refresh a tag defined within an article in Joomla 2.5

     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js">         </script> 
     <script> 
     var auto_refresh = setInterval(
     function()
     {
     alert("testing");
     $('#results').fadeOut('slow').load('#results').fadeIn("slow");
     }, 20000);
     </script-->

     <div id="results">
     {szakitable  csv = "http://127.0.0.1/msedcl/Archives/status2.csv" csvseparator=","  width= 430}
     {/szakitable}
     </div>

上面的代码利用了一个称为szaki表的扩展,该扩展允许将csv文件直接嵌入到文章中. 我要求div每20秒重新加载一次,以使csv文件中所做的更改反映在网页上. 问题:当我调用"$('#results').fadeOut('slow').load('#results').fadeIn("slow");时, 发生的情况是整个页面都在div区域内重新加载.这不是我所需要的.

The above code makes use of an extension called szaki tables, which allows csv file to be directly embedded into an article. I require that the div should reload every 20 seconds so that the changes made in the csv file get reflected on the webpage. PROBLEM When i call "$('#results').fadeOut('slow').load('#results').fadeIn("slow");" what happens is the entire page is reloaded within the div area. This is not what I require.

请提出任何建议!

推荐答案

您尝试过吗?

$('#results').fadeOut('slow').load('{current_page.html} #results').fadeIn("slow");

用文档的文件名替换{current_page.html}

Replace {current_page.html} with the file name of the document

$('#results').fadeOut('slow', function(){
    $(this).load('index.html #results').fadeIn("slow")
});

这篇关于使用javascript自动刷新div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆