Methods for adding file content to html files summary _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.