如何将一个.html导入进另一个.html页面?

如何将一个.html导入进另一个.html页面?,第1张

html中引入调用另一个html的方法,尝试了好几种,都列出来: 

其中第一种是最好的,其他的方法,可以尝试看看,是不是适合你当前项目

一、div+$(“#page1”).load(“b.html”) 

参考代码

二、iframe 

参考代码:

三、object引入 

参考代码:

四、import引入 

参考代码:

五、bootstrap的panel组件,或者easyui的window组件,有点类似这个效果;

HTML里用如何包含引用另一个html文件

整理了3个方法,一个是HTML的iframe标签,别两个是JS引用。比如要在arr.html文件里引用index.html文件,方法如下。

1、HTML引用方法:

<iframe name="toppage" width=100% height=100% marginwidth=0 marginheight=0 frameborder="no" border="0"  src="index.html" ></iframe>

2、JS引用方法:

<object style="border:0px" type="text/x-scriptlet" data="index.html" width=100% height=100%></object>

3、<script type="text/javascript" src="index.js"></script>

html 中include另外一个页面

两个页面     technologies.html  head.html  在  technologies.html 中使用 include

使用chrome 打开 technolliges.html,页面没有任何显示。原因 html不支持 include,解决方案参考:csdn: html中include方法 。参考方法将.html改成 .aspx,在technologies.aspx中打开可以显示 head.html中的内容。有一个未解决问题  windows 2000 IIS 中的  default.aspx 页面不支持默认主页面,支持default.html,暂时无法使用该方案,但可以尝试另外一个iframe方案,iframe方案支持在html页面中包含其它页面。

在html页面中引入另一个html页面的标签

1、用iframe标签

<iframe SRC="xxxx.html" ></iframe>

2、用object标签

<object data="xxxx.htm"></object>

3、behavior的download方式

例:

1.IFrame引入

[代码] <IFRAME NAME="content_frame" width=100% height=30 marginwidth=0 marginheight=0 SRC="import.htm" ></IFRAME>

2.<object>方法

[代码] <object style="border:0px" type="text/x-scriptlet" data="import.htm" width=100% height=30></object>

3.Behavior的download方法

[代码]

<span id=showImport></span>

<IE:Download ID="oDownload" STYLE="behavior:url(#default#download)" /> <script>

function onDownloadDone(downDate){  showImport.innerHTML=downDate

}

oDownload.startDownload('import.htm',onDownloadDone)  </script>

超文本标记语言, 标准通用标记语言下的一个应用。“ 超文本 ”就是指页面内可以包含图片、 链接,甚至音乐、 程序等非文字元素。超文本标记语言的结构包括 “头”部分(英语:Head)、和“主体”部分(英语:Body),其中“头”部提供关于网页的信息,“主体”部分提供网页的 具体内容。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/11513006.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-16
下一篇 2023-05-16

发表评论

登录后才能评论

评论列表(0条)

保存