假如只有一个iframe
<script>
function refreshFrame( url ){
    document.all.tags('iframe')[0].src = url
}
setTimeout("refreshFrame('http://')",30000)
<script>随意写,未测试

解决方案 »

  1.   

    有两个iframe,只刷新其中一个,而且必须得重新从服务器读取数据,而不是仅判断服务器内容是否改变。请指教,谢了
      

  2.   

    <script>
    document.write("<iframe name=box src=http://xxx.xxx.xxx>")
    function refreshFrame(){
        parent.box.location.href='http://xxx.xxx.xxx';
        setTimeout("refreshFrame()",30000);
    }
    refreshFrame()
    <script>
      

  3.   

    这样为什么不行:
    <script>
    document.write("<iframe name=box src=http://www.baidu.com width=250 height=200>")
    function refreshFrame(){
        parent.box.location.reload(true);
        
    }
    setTimeout("refreshFrame()",5000);</script>
      

  4.   

    是因为"没有权限"吗?
    因为iframe的页面和外面的页面是跨域的页面,所以没有权限访问iframe的window下面的对象,象document,location等,不过可以访问iframe本身的方法或属性,象这样
    <script>
    document.write("<iframe name=box src=http://www.baidu.com width=250 height=200>")
    function refreshFrame(){
        document.getElementsByName("box")[0].src = document.getElementsByName("box")[0].src;
    }setTimeout("refreshFrame()",1000);</script>
      

  5.   

    改成这样还是不行呀:
    function refreshFrame(){
        document.getElementsByName("box")[0].location.reload();
    }
    reload()函数根本就没有就调用呀?
      

  6.   

    为什么这样能从www.baidu.com转到www.google.com:
    <script>
    document.write("<iframe name=box src=http://www.baidu.com width=250 height=200>")
    function refreshFrame(){
       parent.box.location.href="http://www.google.com";        
    }
    setTimeout("refreshFrame()",5000);</script>而这样却不能实现刷新:
    <script>
    document.write("<iframe name=box src=http://www.baidu.com width=250 height=200>")
    function refreshFrame(){
       parent.box.location.reload();
    }
    setTimeout("refreshFrame()",5000);</script>请高手指点呀!!!