HTML引用公共页面三种方式(header.html和footer.html)

1.Jquery load方式

<body>
<div class="headerpage"></div>
<div>...中间部分...</div>
<div class="footerpage"></div>
<script src="js/jquery/2.0.0/jquery.min.js"></script>
<script>
    $(function(){
        $(".headerpage").load("header.html");
        $(".footerpage").load("footer.html");
    });
</script>
</body>

2.把html转为js引入

<script type="text/javascript" src="header.js"></script>

3.使用iframe

<iframe src="header.html" scrolling="no" frameborder="0" height="100%" id="mainFrame" width="100%"></iframe>

 

posted @ 2021-05-13 08:57  Oopy  阅读(2094)  评论(0)    收藏  举报