使页眉和页脚文件包含在多个html页面中

使页眉和页脚文件包含在多个html页面中,第1张

使页眉和页脚文件包含在多个html页面中

您可以使用jquery完成此 *** 作。

将此代码放在

index.html

<html><head><title></title><script    src="https://pre.jquery.com/jquery-3.3.1.js"    integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="    crossorigin="anonymous"></script><script> $(function(){  $("#header").load("header.html");   $("#footer").load("footer.html"); });</script> </head><body><div id="header"></div><!--Remaining section--><div id="footer"></div></body></html>

并将此代码放在

header.html
和中
footer.html
,与
index.html

<a href="http://www.google.com">click here for google</a>

现在,当您访问时

index.html
,您应该可以单击链接标记。



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5509154.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-13
下一篇 2022-12-13

发表评论

登录后才能评论

评论列表(0条)

保存