Home > Web Front-end > HTML Tutorial > Files in HTML contain

Files in HTML contain

巴扎黑
Release: 2017-08-21 11:24:01
Original
2348 people have browsed it

In forums, netizens often ask, 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!
1.IFrame is introduced, look at the following code

<IFRAME NAME="content_frame" width=100% height=30 marginwidth=0 marginheight=0 SRC="import.htm" ></IFRAME>
Copy after login

You will see an externally imported file, but you will find that there is something like an outer frame surrounding it. Can be used:

  <iframe name="content_frame" marginwidth=0 marginheight=0 width=100% height=30 src="import.htm" frameborder=0></iframe>
Copy after login

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 are using IE5. 5, you can read this article about transparent colors. If you want to prevent the scroll bar from appearing when the imported file is too long, add scroll=no

to the body in import.htm 2.< ;object>Method

<object style="border:0px" type="text/x-scriptlet" data="import.htm" width=100% height=30></object>
Copy after login

    3. Behavior download method

 <span id=showImport></span>
        <IE:Download ID="oDownload" STYLE="behavior:url(#default#download)" />
        <script> 
        function onDownloadDone(downDate){
        showImport.innerHTML=downDate
        } 
        oDownload.startDownload(&#39;import.htm&#39;,onDownloadDone)
        </script>
Copy after login

The above is the detailed content of Files in HTML contain. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template