iframe.html<html>
<head>
<title>实现iframe局部刷新</title>
</head>
<body>
<div id="iframeDiv" style="display:block;position:absolute;left:200px;top:300px;width:200px;height:1000px">
<iframe id="parentIframe" name="parentIframe" src="parentIframe.html" scrolling="yes"></iframe>
</div>
<button name="refresh" onclick="reloads()">实现局部刷新</button>
</body>
</html>
<SCRIPT LANGUAGE="JavaScript">
<!--
function reloads()
{
parentIframe.winodw.location.reload();
}

//-->
</SCRIPT>
parentIframe.html<html>
<head>
<title>parent Iframe</title>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!--
 var date = new Date();
 document.write(date);
//-->
</SCRIPT>
</body>
</html>需要注意的是,我试了很多方法 都能刷新,但它也把iframe.html也刷新了,能不能有什么方法实现局部刷新,不能刷新iframe.html,只会刷新parentIframe.html

解决方案 »

  1.   

    iframe.html,iframe并没有刷新,只刷新了parentIframe<html>
    <head>
    <title>实现iframe局部刷新 </title>
    </head>
    <body>
    <div id="iframeDiv" style="display:block;position:absolute;left:200px;top:300px;width:200px;height:1000px">
    <iframe id="parentIframe" name="parentIframe" src="parentIframe.html" scrolling="yes"> </iframe>
    </div>
    <button name="refresh" onclick="reloads()">实现局部刷新 </button>
    </body>
    </html>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function reloads()
    {
            document.parentIframe.location.reload();
    }
    var date = new Date();
    document.write(date); 
    //-->
    </SCRIPT> 
      

  2.   

    LS可以 或者是重新指定下那个IFRAME的地址
      

  3.   

    window.parent.frames["carnoc"].location.reload();
    carnoc代表你框架某个部分的名称