html动态添加公共页头和页脚

//js部分:
<script>
  $(function(){
    $(document).ready(function(){
    //jquery load方法加载公共头部
        $("#footer").load("footer.html");
    });
  })
</script>
//在需要引用的页面中加添id为footer的节点即可

<div id="footer"></div>
//footer.html 不需要多余的<head>节点,直接dom就行

 <footer class="cpy-right bg-theme ">
        <h1>
         我是公共页脚 
        </h1>     
 </footer>
  

  

posted @ 2020-11-18 17:28  Lucyy  阅读(619)  评论(0编辑  收藏  举报