【发布时间】:2021-02-08 20:07:16
【问题描述】:
我希望能够单击page1.html 上的按钮,然后打开一个新页面(例如portal.html),其中包含一个 iframe,该 iframe 的 URL 是在 iframe 中指定的。
所以,我想要 2 页。 page1.html 和 portal.html。门户页面上有一个 iframe,我希望该 iframe 的 URL 根据我在 page1.html 上按下的按钮进行更改。
例如,page1.html 将有 2 个按钮,button1 和 button2。
- 如果我单击 button1,我将被发送到 portal.html 并在 iframe 中显示https://example.com。
- 如果我点击按钮 2,我将被发送到 portal.html 并在 iframe 中显示https://stackoverflow.com。
这可能吗?如果可以,我该怎么做?如果可能的话,我宁愿在没有任何服务器端代码(如 PHP)的情况下这样做。
编辑
我将有 5 页。
- index.html
- portal.html
- page1.html
- page2.html
- page3.html
Portal.html 将有一个 iframe。
Index.html 将有 3 个按钮。
- 如果我单击 button1,我想加载页面 portal.html(在新选项卡中)但在 iframe 中使用 page1.html(在 portal.html 上)
- 如果我单击 button2,我想加载页面 portal.html(在新选项卡中),但在 iframe 中使用 page2.html(在 portal.html 上)
- 如果我单击 button3,我想加载页面 portal.html(在新选项卡中),但在 iframe 中使用 page3.html(在 portal.html 上)
【问题讨论】: