我正在尝试在我的index.htm文件中添加footer.htm,但目前为止我无法使用。这是我的代码。如何在html中包含html文件
的index.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<p>This is my index page!</p>
<!--#include virtual="footer.htm" -->
<!--#include file="footer.htm" -->
</body>
</html>
footer.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<p>This is my footer</p>
</body>
</html>
我已经尝试过的Visual Studio 2010中内置的Web服务器,我也通过Apache,但没有运气whatsoever.Please注试过了我我正在试试html5
不,你不是“HTML 5,尝试它”(即HTM而不是HTML)。你的'DOCTYPE'是用于XHTML 1.0 Transitional,而不是HTML 5. – derekerdmann
如果include是这种情况,你想在index.htm中显示你的footer.htm,iframe会为你做这个工作,放置'
我可能不会使用html5,但目标是模式是html5 ..也可以用您的解决方案我可以使用iframe来达到目的..您的建议是什么?我想在每个页面上包含页脚和页眉......我应该使用iframe还是其他内容? – Ghaffar