简体   繁体   English

将 HTML 文件导入另一个 HTML

[英]Import HTML file into another HTML

I'm trying to import HTML file into HTML.我正在尝试将 HTML 文件导入 HTML。
I need something like this:我需要这样的东西:

<div>
  <iframe  onload="iframe.document.head.appendChild(ifstyle)" name="log" src="Objects.html"></iframe>
  <style>
  iframe {
    height: 300px;
    position: absolute;
    bottom: 5px;
    width: 100%;
  }
</style>

But <iframe> crushes all the code in the main HTML file and causes thousands of errors like:但是<iframe>破坏主 HTML 文件中的所有代码并导致数千个错误,例如:

Error: attribute points: Unexpected end of attribute.错误:属性点:属性意外结束。 Expected number, "…5390592086273 0 ".预期数字,“...5390592086273 0”。

Also:还:

Blocked a frame with origin "null" from accessing a cross-origin frame at HTMLIFrameElement.onload在 HTMLIFrameElement.onload 中阻止了源为“null”的框架访问跨源框架

So I need to put HTML into another HTML and style it.所以我需要将 HTML 放入另一个 HTML 并为其设置样式。

Use the element to link files from HTML, CSS, or javascript:使用该元素从 HTML、CSS 或 javascript 链接文件:

<html>
<head>...</head>
<body>
<link herf="blah.html">
</body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM