一个iframe我需要每30秒刷新一次(但不是整个页面) [英] An Iframe i need to refresh every 30 seconds (but not the whole page)

查看:287
本文介绍了一个iframe我需要每30秒刷新一次(但不是整个页面)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这段代码

<iframe marginwidth="0" marginheight="0" width="240" height="80" scrolling="no" frameborder=0 src="irc_online.php">
</iframe>

我将这个添加到我在侧边栏上的html小部件中,有没有办法可以制作这个刷新说每30秒而不是我页面的其余部分?

I am adding this to a html widget I have on a sidebar, Is there a way I can make this refresh say every 30 seconds and not the rest of my page?

很多
谢谢

推荐答案

您可以在irc_online.php中放置元刷新标记

You can put a meta refresh Tag in the irc_online.php

<meta http-equiv="refresh" content="30">

或者你可以使用Javascript和setInterval刷新Source的src ......

OR you can use Javascript with setInterval to refresh the src of the Source...

<script>
window.setInterval("reloadIFrame();", 30000);

function reloadIFrame() {
 document.frames["frameNameHere"].location.reload();
}
</script>

这篇关于一个iframe我需要每30秒刷新一次(但不是整个页面)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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