2012-05-24 105 views
-2

我正在尝试在我的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

+1

不,你不是“HTML 5,尝试它”(即HTM而不是HTML)。你的'DOCTYPE'是用于XHTML 1.0 Transitional,而不是HTML 5. – derekerdmann

+0

如果include是这种情况,你想在index.htm中显示你的footer.htm,iframe会为你做这个工作,放置'