Home >Web Front-end >HTML Tutorial >Files in HTML contain
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>
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>
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>
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('import.htm',onDownloadDone) </script>
The above is the detailed content of Files in HTML contain. For more information, please follow other related articles on the PHP Chinese website!