我有两个HTML文件,假设a.HTML和b.HTML。在a.html中,我想包括b.html
在JSF中,我可以这样做:
<;ui:include src=”https://stackoverflow.com/questions/8988855/b.xhtml“/>;
这意味着在a.xhtml文件中,我可以包含b.xhtml
我们如何在*.html文件中执行此操作
我认为最好的解决方案是使用jQuery:
a.html:
<;html>;
<;头>;
<;脚本src=”https://stackoverflow.com/questions/8988855/jquery.js“></脚本>;
<;脚本>;
$(函数(){
$(“#includedContent”).load(“b.html”);
});
</脚本>;
</头>;
<;车身>;
<;div id=“includedContent”></部门>;
</车身>;
</html>;
b.html:
<;p>;这是我的包含文件</p>;
这个方法简单明了地解决了我的问题
jQuery.load()文档在这里