从子 iframe 访问父 iframe

发布于 2024-08-03 07:21:08 字数 839 浏览 1 评论 0原文

好的,我有一个 html 页面,上面有两个 iframe。

-------------------------------------------------
|              PARENT                           |
|                                               |
|                                               |
|     [iframe1 id=i1 name=i1]                   |    
|                                               |
|                                               |
|                                               |
|     [iframe2 id=i2 name=i2]                   |
|                                               |
|                                               |
-------------------------------------------------

当我单击 iframe1 中的链接时,我需要在 iframe2 中显示结果页面。我已经尝试过:

<a href=blah.html target=parent.i2>link</a>

但这不起作用。

有人知道该怎么做吗?

Okay, I have an html page with two iframes on it so.

-------------------------------------------------
|              PARENT                           |
|                                               |
|                                               |
|     [iframe1 id=i1 name=i1]                   |    
|                                               |
|                                               |
|                                               |
|     [iframe2 id=i2 name=i2]                   |
|                                               |
|                                               |
-------------------------------------------------

When I click on a link in iframe1, i need the resulting page to display in iframe2. I have tried:

<a href=blah.html target=parent.i2>link</a>

but that does not work.

any one know how to do this?

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

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

发布评论

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

评论(2

墨落成白 2024-08-10 07:21:08

我想你可能需要 JavaScript。像这样的东西

 onclick="javascript:parent.i2.document.location='blah.html'"

I think you might need JavaScript. Something like

 onclick="javascript:parent.i2.document.location='blah.html'"
清风夜微凉 2024-08-10 07:21:08
<a href=blah.html target="i2">link</a>

您只需输入“i2”,它应该是该页面中唯一的窗口名称。无需指定父级等。

<a href=blah.html target="i2">link</a>

You just need to put "i2" it should be unique window name in this page. No need to specify parent etc.

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