简体   繁体   English

如何将多个 HTML 文件链接到单个文件中

[英]How Can I link several HTML files into a singular file

Im looking to figure out how to compile a couple of html pages into one page.我想弄清楚如何将几个 html 页面编译成一个页面。 like if i made a triangle in one html page, how would i link it with another html page that has a rectangle for example so that they both show up in one page.就像我在一个 html 页面中制作了一个三角形一样,我如何将它与另一个具有矩形的 html 页面链接,以便它们都显示在一个页面中。 of course im not trying to figure out how to do this specifically but i want to generally know how to do it.当然,我不是想弄清楚如何具体做到这一点,但我想大致知道如何做到这一点。

With jquery you can do it like so:使用 jquery 你可以这样做:

 <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> $(function(){ $("#includeContent").load("fileName.html"); }); </script> </head> <body> <div id="includeContent"></div> </body> </html>

source: https://www.codegrepper.com/profile/abutahir来源: https ://www.codegrepper.com/profile/abutahir

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM