In the forum, netizens often ask, can I read the contents of another html file in an html file? The answer is yes, and there is more than one way. In the past, I only used iframe to reference, and later I found several other methods. Today I will summarize these methods for your reference. I think the third method is better! 1.IFrame introduction, look at the following code Copy code The code is as follows:<IFRAME NAME="content_frame" width=100% height=40 marginwidth=0 marginheight=0 SRC="import.htm" ></IFRAME> You will see an externally imported file, but you will find something like an outer frame surrounding it. You can use Copy code The code is as follows:<iframe name="content_frame" marginwidth=0 marginheight=0 width=100% height=40 src="import.htm" frameborder=0></iframe> But you will find that there is still a problem, that is, the background color is different. You can just use the same background color in the imported file import.htm, but if you use If you are using IE5.5, you can read this article about transparent colors. If you want to import a long file without scroll bars, add this to the body of import.htm: Enter scroll=no *Disadvantages: Unable to do navigation jump, jump inside iframe, content overlap appears 2.<object> method Copy code The code is as follows:<object style="border:0px" type="text/x-scriptlet" data="import.htm" width=100% height=30></object> object tag — defines an embedded object (e.g. image, media, code, etc.) * It does not conform to the concept of standard web design and has been abandoned by standard web design. 3.Behavior download method Copy code The code is as follows:<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> |
<<: How to implement rounded corners with CSS3 using JS
>>: Pure CSS code to achieve flow and dynamic line effects
When using VMware Workstation to open a virtual m...
Overview of MySQL Partitioned Tables We often enc...
Table of contents 1. Open the project directory o...
This article example shares the specific code of ...
Preface Recently, part of the company's busin...
The content involved in Web front-end development...
What does linux cd mean? In Linux, cd means chang...
Last time, we came up with two header layouts, on...
Table of contents 1. Use RGB to represent color 2...
The specific code of JavaScript date effects is f...
This article example shares the specific code of ...
Mysql join query 1. Basic concepts Connect each r...
Preface This article uses the new features of MyS...
Preface Hello everyone, this is the CSS wizard - ...
First, we need to use the transform-origin attrib...