我想要通用页眉和页脚所有的页面



我包括以下内容来完成它。但是由于这个原因,页面上的Javascript元素无法工作。

<html>
<head>
    <script type="text/javascript">
        $(document).ready(function(){ 
        $.get("header.html", function(data) {
    $("#header").html(data);
       });
     });
   </script>
</head>
<body>
<div id="header"></div>
<content>
</content>
</body>
</html>

如果您可以在您的机器上设置像XAMPP这样的虚拟服务器,那么使用PHP,您可以使用一行代码在任何页面上包含页眉和页脚。

<header><?php include 'header.php';?></header>

和页脚

<footer><?php include 'footer.php';?></footer>

最新更新