Home >Web Front-end >HTML Tutorial >Summary of methods for including file content in html files_HTML/Xhtml_Web page production

Summary of methods for including file content in html files_HTML/Xhtml_Web page production

WBOY
WBOYOriginal
2016-05-16 16:36:371833browse

Netizens often ask in forums, can I read the content of another html file in one html file? The answer is yes, and there is more than one method. In the past, I would only use iframe to reference, but later I found several other methods. So today I will summarize these methods for your reference. I think the third method is better. good!

Several ways to introduce other html files into html files

1.IFrame is introduced, look at the code below


Copy code
The code is as follows:


You will see an externally imported file, but you will find that it is surrounded by something like an outer frame. You can use


Copy code
The code is as follows:


But you will find that there is still a problem, that is, the background color is different. You only need to use the same background color in the imported file import.htm, but if you use

If you are using IE5.5, you can read this article about transparent colors. If you want to import a file that is too long so that the scroll bar does not appear, add

to the body in import.htm.

Enter scroll=no

*Disadvantages: Unable to make navigation jumps, jump inside iframe, content overlay appears

2.Method


Copy code
The code is as follows:


object tag — defines an embedded object (e.g. image, media, code, etc.)

* Concepts that do not conform to standard web design have been abandoned by standard web design.

3. Download method of Behavior


Copy code
The code is as follows:

< /span>

<script><br>function onDownloadDone(downDate){<br>showImport.innerHTML=downDate<br>}<br>oDownload.startDownload('import.htm',onDownloadDone)<br></script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn