如何在我的html页面中使用多个iFrame?

时间:2011-11-09 16:57:45

标签: html iframe

我只是将它们一个接一个地放在页面正文中。如果我使用<object>执行此操作,我会全部看到它们。使用iFrames,我只看到第一个。

<iframe id="AlertMaintenance" style="border-style: none; border-color: inherit; border-width: 0px; height:1222px; width:100%;" src="AlertMaintenance.html"/>

<iframe id="DelayReason" style="border-style: none; border-color: inherit; border-width: 0px; height:1222px; width:100%;" src="DelayReason.html"/>

3 个答案:

答案 0 :(得分:46)

您必须指定</iframe>结束标记。自闭标签(/>)不起作用。

工作代码:

<iframe id="AlertMaintenance" style="border-style: none; border-color: inherit; border-width: 0px; height:1222px; width:100%;" src="AlertMaintenance.html"></iframe>
<iframe id="DelayReason" style="border-style: none; border-color: inherit; border-width: 0px; height:1222px; width:100%;" src="DelayReason.html"></iframe>

需要结束标记。另见:MDN: iFrame

答案 1 :(得分:3)

iframe有一个结束标记:

<iframe ...></iframe>

添加em&#39;英寸

答案 2 :(得分:2)

您正在尝试使用自我标记。

将其更改为:

<iframe id="AlertMaintenance" style="border-style: none; border-color: inherit; border-width: 0px; height:1222px; width:100%;" src="AlertMaintenance.html"></iframe>

<iframe id="DelayReason" style="border-style: none; border-color: inherit; border-width: 0px; height:1222px; width:100%;" src="DelayReason.html"></iframe>