Several ways to introduce other HTML files into HTML files

Source: Internet
Author: User
Tags object transparent color

In the forum often have netizens asked, can in an HTML file read another HTML file content? The answer is OK, and the method is more than one, in the past I will only use the IFRAME to quote, and later found several other methods, then today summed up these several methods for everyone to refer to.

1.IFrame Introduction, look at the following code

--------------------------------------------------------------------------------
<iframe name= "Content_frame" width=100% height=30 marginwidth=0 marginheight=0 src= "import.htm" ></IFRAME >
--------------------------------------------------------------------------------

You will see an externally introduced file, but you will find that there is something similar to the bounding box that surrounds it and can be used

--------------------------------------------------------------------------------
<iframe name= "Content_frame" marginwidth=0 marginheight=0 width=100% height=30 src= "import.htm" frameborder=0> </iframe>
--------------------------------------------------------------------------------

But you will find that there is a problem, that is, the background color is different, you can only use the same background color in the introduction of the file import.htm, but if you are using IE5.5, you can look at this article about transparent color If the file you want to introduce is too long to appear without a scroll bar, add scroll=no to the body in import.htm

2.<object> Way

--------------------------------------------------------------------------------
<object style= "border:0px" type= "Text/x-scriptlet" Data= "import.htm" width=100% height=30></object>
--------------------------------------------------------------------------------

The way of 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>
--------------------------------------------------------------------------------



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.