我已经编写了以下代码,单击的按钮将在新窗口中打开一个网页。我想要的按钮来打开一个名为“目的地”的iframe中的网页。代码如下
<button class="button" onclick="window.open('index1.php')" target="destination">3-2</button>        
<button class="button" onclick="window.open('index2.php')" target="destination">4-1</button>        发布于 2021-06-28 11:40:39
您不能直接打开iFrame,因为Iframe将在另一个网页中显示窗口。因此,您必须链接到包含iFrame窗口网页。
但是,您可以使用包含所有iFrame选项的网页,例如:
if request(i) = "1" {$frame = "content1.php;)
else if request(i) = "2" {$frame = "content2.php;}
else if request(i) = "3" {$frame = "content3.php;}然后在你的iFrame中写下:
<iframe src="<?php echo $frame; ?>"></iframe> 然后使用类似http://example.com/page.php?i=2的东西链接到您的iFrame
https://stackoverflow.com/questions/68156947
复制相似问题