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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8068578/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 11:27:03  来源:igfitidea点击:

How do I use multiple iFrames in my html page?

htmliframe

提问by Yatrix

I just have them in the body of the page one after the other. If I do this with <object>, I see them all. With iFrames, I only see the first one.

我只是将它们一个接一个地放在页面的正文中。如果我用 来做这件事<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"/>

回答by Rob W

You have to specify a </iframe>closing tag. Self-closing tags ( />) don't work.

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

Working code:

工作代码:

<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>

End tags are required. See also: MDN: iFrame.

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

回答by Blender

Iframe has a closing tag:

iframe 有一个结束标签:

<iframe ...></iframe>

Add em' in.

添加它们。

回答by PeeHaa

You're trying to use selfclosing tags.

您正在尝试使用自闭合标签。

Change this to:

将此更改为:

<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>