1、采用js方法
document.getElementById("div").innerHTML = '';
$("#div").load("index.html");
2、采用apache等服务器,使用include
apache默认不支持SSI,可以通过修改配置文件来使其支持
搜索AddType text/html .shtml的位置,打开以下注释
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
同时需要找到Options Indexes FollowSymLinks,在其后添上Includes
以上表示支持shtml的include命令,如果还想支持html,则需改为
AddType text/html .shtml .html
AddOutputFilter INCLUDES .shtml .html
使用办法:
建立A.html文件如下html>
include建立B.html文件如下
我是被include包含进来的