Introduce a method to call another html in html

The method of calling another html is introduced in html. I have tried several methods, and they are all listed: 
the first one is the best ( to be deployed on the server ), and the other methods can be tried to see if they are suitable for your current situation. project

1. div+$(“#page1”).load(“b.html”) 
reference code:

<body>
    <div id="page1"></div>
    <div id="page2"></div>
    <script>
          $("#page1").load("page/Page_1.html");
          $("#page2").load("page/Page_2.html");
    </script>
</body>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

Second, the iframe 
reference code:

<head>
</head>
<body>
   <div id="page1">
        <iframe align="center" width="100%" height="170" src="page/Page_1.html"  frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
   </div>
   <div id="page2">
        <iframe align="center" width="100%" height="170" src="page/Page_2.html"  frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
   </div>
</body>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

3. Object introduction 
reference code:

<head>
    <object style="border:0px" type="text/x-scriptlet" data="page/Page_1.html" width=100% height=150>
    </object>
</head>
  • 1
  • 2
  • 3
  • 4

Fourth, import the 
reference code:

<head>
    <link rel="import" href="page/Page_1.html" id="page1">
</head>
<body>
    <script>
        console.log(page1.import.body.innerHTML);
    </script>
</body>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

Reference article: https://www.web-tinker.com/article/20637.html

5. The panel component of bootstrap, or the window component of easyui, is somewhat similar to this effect;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326252755&siteId=291194637