如何在html中调用html文件

html-css018

如何在html中调用html文件,第1张

有两种方法。1,<!--#include file="wedding_bottom.html"-->注意这种方式被引入的html文件不能含有<html><head><body>标签。2,<iframe width="869px" height="768px" id="windows" name="windows" frameborder="0" src="hkprintingone.asp" scrolling="auto" style="overflow:scrolloverflow-x:hiddenoverflow-x:hidden !importantoverflow-y:hiddenoverflow-y:auto !importantborder-right:#F2A116 1px solid"></iframe>这种方式就没有上面的要求。

你可以将首页需要更新的内容都分别做成一个html,然后首页就使用iframe将各个需要更新的内容嵌进来,其余的几个html文件亦同样用iframe嵌入相应的html即可,其中iframe的使用方法如下:

<iframe

src="相同更新内容的html页面路径"

frameborder="0"

scrolling="no"></iframe>

相当于你的首页将会是大概这样子:

<html>

<head>

<title>首页</title>

</head>

<body>

<div

class="header">

<iframe

src="header.html"

frameborder="0"

scrolling="no"></iframe>

</div>

<div

class="content">

<iframe

src="content1.html"

frameborder="0"

scrolling="no"></iframe>

<iframe

src="content2.html"

frameborder="0"

scrolling="no"></iframe>

<iframe

src="content3.html"

frameborder="0"

scrolling="no"></iframe>

<iframe

src="content4.html"

frameborder="0"

scrolling="no"></iframe>

</div>

<div

class="footer">

<iframe

src="footer.html"

frameborder="0"

scrolling="no"></iframe>

</div>

</body>

</html>

而二级页面可能只需要首页的头部,脚部,还有其中一部分内容

<html>

<head>

<title>首页</title>

</head>

<body>

<div

class="header">

<iframe

src="header.html"

frameborder="0"

scrolling="no"></iframe>

</div>

<div

class="content">

<iframe

src="content2.html"

frameborder="0"

scrolling="no"></iframe>

</div>

<div

class="footer">

<iframe

src="footer.html"

frameborder="0"

scrolling="no"></iframe>

</div>

</body>

</html>