This article mainly describes how to include the file content in html files. For more information about the methods, see, can I read the content of another html file from an html file? The answer is yes, and there are more than one method. In the past, I used iframe to reference it. Later I found several other methods, today we will summarize these methods for your reference. I think the third method is better!
Several Methods for introducing other html files into html files
1. Introduce IFrame and look at the following code:
The Code is as follows:
You will see an externally introduced file, but you will find that there is something similar to the external box that will enclose it, you can use
The Code is as follows:
However, you may find that the background color is different. You only need to use the same background color in the imported file import.htm.
For IE5.5, you can read this article about transparent colors. If you want to import a file that is too long, you can add a scroll bar to the body of import.htm.
Scroll = no
* Disadvantage: navigation jumps are not allowed. In iframe, content overlay occurs.
2.Method
The Code is as follows:
Object tag-defines an embedded object (such as image, media, Code etc)
* The standard webpage design has been abandoned because it does not conform to the standard webpage design concept.
3. Behavior download Method
The Code is as follows:
Script
Function onDownloadDone (downDate ){
ShowImport. innerHTML = downDate
}
Odownload.startdownload('import.htm', onDownloadDone)
Script