Netizens often ask in forums, can I read the content of another html file in an 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! <IFRAME NAME="content_frame" width=100% height=30 marginwidth=0 marginheight=0 SRC="import.htm" ></IFRAME> <iframe name="content_frame" marginwidth=0 marginheight=0 width=100% height=30 src="import.htm" frameborder=0></iframe> <object style="border:0px" type="text/x-scriptlet" data="import.htm" width=100% height=30></object> <span id=showImport></span>
1.IFrame is introduced, look at the following code
You will see an externally imported file, but you will find that it is surrounded by something like an outer box. You can use:
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 transparency 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
3.Behavior download method
<IE:Download ID="oDownload" STYLE="behavior:url(#default#download)" />
<script>
function onDownloadDone(downDate){
showImport.innerHTML=downDate
}
oDownload.startDownload('import.htm',onDownloadDone)
</script>