Blogger Information
Blog 34
fans 0
comment 1
visits 23291
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
html中引入调用另一个html的方法
感恩的心的博客
Original
1863 people have browsed it

html中引入调用另一个html的方法,尝试了好几种,都列出来:
其中第一种是最好的,其他的方法,可以尝试看看,是不是适合你当前项目

一、div+$(“#page1”).load(“b.html”)
参考代码:

<body>
    <div id="page1"></div>
    <div id="page2"></div>
    <script>
          $("#page1").load("page/Page_1.html");
          $("#page2").load("page/Page_2.html");
    </script>
</body>
二、iframe
参考代码:

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

三、object引入
参考代码:

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

四、import引入
参考代码:

<head>
    <link rel="import" href="page/Page_1.html" id="page1">
</head>
<body>
    <script>
        console.log(page1.import.body.innerHTML);
    </script>
</body>

参考文章:https://www.web-tinker.com/article/20637.html

五、bootstrap的panel组件,或者easyui的window组件,有点类似这个效果;
---------------------
作者:seanin
来源:CSDN
原文:https://blog.csdn.net/arvin0/article/details/56839242?utm_source=copy
版权声明:本文为博主原创文章,转载请附上博文链接!

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!