IFrame 定位另一个 IFrame

发布于 2024-08-22 18:20:11 字数 116 浏览 4 评论 0原文

我有一个包含两个 iframe 的父页面。一个保存导航链接,另一个应显示与第一个 iframe 中单击的导航链接相关的信息。所以我需要从另一个 iframe 中定位一个 iframe。这可能吗?如果是这样,该怎么办呢?

I have a parent page containing two iframes. One holds navigation links and the other should display the information pertaining to the navigation link clicked in the first iframe. So I need to target the one iframe from within another iframe.Is this possible? If so how does one go about it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽袖吟 2024-08-29 18:20:11

我想通了。对于那些想了解的人,您需要使用 javascript 来访问父文档元素并更改属性。因此,为了回答我自己的问题,我们设置 onclick 链接来运行以下 javascript:

parent.document.getElementById('frameName').src = 'page.html';

I figured it out. For those who want to know, you need to use javascript to access the parent document elements and change the attributes. So to answer my own question, one sets the onclick link to run the following javascript:

parent.document.getElementById('frameName').src = 'page.html';
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文