Some ways to introduce HTML files into other HTML files: include

Source: Internet
Author: User

Can I read the contents of another HTML file in one HTML file? The answer is OK, and the method is not only one, in the past I will only use the IFRAME to refer to, and later found that there are several other methods, then today summed up these methods for your reference.

  1.IFrame Introduction

a.html Introduction of b.html content

<iframe name= "Content_iframe" marginwidth=0 marginheight=0 width=100% height=30 src= "b.html" frameborder=0>< /iframe>

Parameters:

    runat= "Server" This is the best addition to the IFRAME jump net can jump in the current IFRAME

Address URL to which SRC is linked

Frameborder whether the border is displayed (0 no Border 1 has a border)

Scrolling whether there is a scrollbar (yes there is no scroll bar no scroll bar)

Allowtransparency background is transparent (yes transparent no opaque)

Detailed Description: http://www.cnblogs.com/kingboy2008/archive/2011/05/10/2055545.html

Insufficient: Many pages have a drop-down list, then the IFRAME is not convenient to use, because it is embedded in a window b window. Then the window of the IFRAME is fixed. Cannot be adjusted automatically. IFrame This I have not used, I have seen some novel sites, because of the confidentiality of the content, do not allow readers to copy the content, they are using the IFrame method.

  

For example, the drop-down list here is going to the Content section, so the IFRAME doesn't work. Then it is convenient to use the Include method. Next there will be an include approach.

  2.<object> Way

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

Defines an embedded object. Please use this element to add multimedia to your XHTML page. This element allows you to specify the data and parameters for inserting objects in an HTML document, as well as code that can be used to display and manipulate the data.

<object> tags are used to include objects, images, audio, video, Java applets, ActiveX, PDF, and Flash.

Object was originally intended to replace the IMG and applet elements. This is not true, however, due to vulnerabilities and lack of browser support.

Object support for the browser depends on the object type. Unfortunately, mainstream browsers use different code to load the same object type.

Fortunately, object objects provide a solution. If the object element is not displayed, the code between <object> and </object> is executed. In this way, we can nest multiple object elements (each corresponding to a browser).

And I use the object method is often used to insert a flash plug-in.

    

Put content into your div

    

<object classid= ' clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 ' name= ' flashdiv ' id= ' flashDiv ' border= ' None '
codebase= ' http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 ' >
<param name= ' movie ' value= ' js/webchat.swf ' >
<param name= ' quality ' value= ' high ' >
<embed src= ' js/webchat.swf ' width= ' 1100 ' height= ' 680 ' quality= ' high ' name= ' flashdiv '

        type= ' Application/x-shockwave-flash ' pluginspage= ' http://www.macromedia.com/go/getflashplayer ' </embed>

</object>

Detailed Link: http://blog.163.com/[email protected]/blog/static/477054722009102492216760/

Param's Explanation: http://201205083157.iteye.com/blog/1863322

  3.include (This is my main explanation here, but also the most convenient to use)

A website many pages inside, part of the content of the code is the same, such as: Head,footer,menu and so on. Then we can write a head, a tail, a menu and then into the need to use the page inside, you do not have to write duplicate code. The include is the code that embeds b.html inside the a.html, which is to piece together the code and not embed a browser in the browser.

The advantage of this is that when repeating code changes a small place, you just need to modify it in one HTML, without having to change the code repeatedly, or because there are too many pages to miss.

  

I divide the content into 4 parts, then introduce Heder, menu, footer into index, will see the page code is complete:

  

However, using include in Windows systems must open IIS.

  1. How do I open IIS?

Control Panel--programs and features--turn Windows features on or off (inside the left menu bar)

  

Tick the selected--Dot OK

2. Create an IIS port

Control Panel--Administrative Tools-->internet Information Services (IIS) Manager

    

Right-click the Red Box section--Add Web site

      

Site name you can fill in the project name.

The physical path is where the project file resides.

The port is useless, a unique port, a token. Otherwise fear after the project to do more to remember confusion.

Such An IIS file was created successfully

3. Create text

The text that is compiled by IIS does not support HTML. However, support for Shtml,include file introduction supports HTML. So we can write files like this:

    

Next, we need to set up an access page for Port 89: index.shtml

    

Control Panel--after administrative tools-->internet Information Services (IIS) Manager:

Open the site on the left and you'll see your new website. Then left-click to see this page, then open the default document:

       

Click Add: Pop-up box to fill in your files, such as: index.shtml. You will see the added files.

Note: Be sure to add the files that need to be opened on the Web site to see the first place.

Then the page opens:

You'll see the page.

    

Some ways to introduce HTML files into other HTML files: include

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.