同路而行

写博客,记录你的生命,走自己的路,有一段我们同行。

在html文件调用其它html文件的几种方法

Codes    一、iframe 方式
[代码]
<iframe name="my_frame" marginwidth=0 marginheight=0 width=100% height=30 src="import.htm" frameborder=0></iframe>
二、object 方式
[代码]
<object style="border:0px" type="text/x-scriptlet" data="import.htm" width=100% height=30></object>
三、Behavior的download方式
[代码]
<span id=showImport></span>
<IE:Download ID="oDownload" STYLE="behavior:url (#default#download)" />
<script>
function onDownloadDone(downDate){ showImport.innerHTML=downDate }
oDownload.startDownload('你要引入的文件.htm',onDownloadDone)
</script>
iframe比较灵活,可以自由设定 iframe 的大小、位置、是否有滚动条等,但有时页面上可能会出现两根滚动条,因此 iframe 比较适用于调入规定的小尺寸页面,并能做到完全融合在一起。

object方式类似于页面集成,举个例子:如果 a.htm 中包含了 b.htm,但浏览器实际看到的代码是:
<html><head><title>xxx</title></head>
<body>a.htm的内容
<html><head><title>xxx</title></head>
<body>b.htm的内容</body></html>
</body></html>
两个页面都含有 javascript 代码容易出错。

上一篇:给地址栏做个小图标下一篇:这两天弄了个微型论坛程序

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

最近发表

热文排行

最新评论及回复

随机文章

月度排行

网友推荐

 更多内容

Powered By Z-Blog 1.8 Arwen Build 81206 Code detection by Codefense

Copyright (C)2008-2010 同路而行.蜀ICP备08106184号..LOGIN