主页面index.html
<iframe id="aIframe" scrolling="no" frameborder="0" class="videoIframe" src="a.html">
</iframe>
<iframe id="bIframe" scrolling="no" frameborder="0" class="videoIframe" src="b.html">
</iframe>b.html有个button,点击后,更改aIframe的src为c.html
在IE8下,parent.document.getElementById("aIframe").src="c.html"可以实现
但是在IE6下不可以,总是报JS错误,有没有其他方法可以实现??

解决方案 »

  1.   

    <iframe id="aIframe" name="ffaa" scrolling="no" frameborder="0" class="videoIframe" src="a.html">
    </iframe>
    <iframe id="bIframe"  scrolling="no" frameborder="0" class="videoIframe" src="b.html">
    </iframe> 
    parent.document.all.ffaa.src="c.html"
      

  2.   

    <iframe id="aIframe" scrolling="no" frameborder="0" class="videoIframe" src="a.html"> 
    </iframe> 
    <iframe id="bIframe" scrolling="no" frameborder="0" class="videoIframe" src="b.html"> 
    </iframe> 
    使用代码:top.document.all.aIframe.src="c.html"
      

  3.   

    你未定义变量所以JS报错
    var a =parent.document.getElementById("aIframe")a.src=""就好了
      

  4.   

    ie6直接用window对象
    window.aIframe="a.html"
      

  5.   

    不好意思,是引用的页面js有错误
    parent.document.getElementById("aIframe").src="c.html"这种写法是没问题的