Thu*_*rse 4 html javascript iframe frame
我在访问加载到iframe中的页面一部分的框架时遇到问题.框架嵌套在多个框架集中.
我的HTML看起来像这样:
<iframe name="sourceframe" src="siteindex.html">
#document <-- this appears in the dom tree. Not sure if it's relevant.
<html>
<head></head>
<frameset>
...other frames
<frameset>
<frame name="targetframe" src="sitesubpage.html">
...I want to access this frame and replace the contents with a different html page...
</frame>
</frameset>
</frameset>
</html>
</iframe>
Run Code Online (Sandbox Code Playgroud)
我读过类似的问题,但没有一个解决方案可以让我开始工作.
任何建议将不胜感激.
window.frames['sourceframe'].frames['targetframe'].location.href = 'new_html_page';
Run Code Online (Sandbox Code Playgroud)
FF和Chrome只有frames收藏window,IE和Opera也有它document.当您更正时间时,上面的代码可以工作(测试).
在更改之前尝试使用一些超时href,或者从更改中触发更改#targetframe.您还可以将onload事件侦听器附加到iframe,并触发其中的更改.另外,您可以将脚本放置iframe在关闭body标记之前,然后您可以使用window.onload更改深度页面...
| 归档时间: |
|
| 查看次数: |
16227 次 |
| 最近记录: |