Methods for sharing the head and tail of a webpage. Methods for sharing the head of a webpage

Source: Internet
Author: User

Methods for sharing the head and tail of a webpage. Methods for sharing the head of a webpage

The head and tail of the same website are usually the same. As long as all webpages share the head and tail, maintenance of the webpage becomes much easier, you only need to modify one page to change the header and tail of all webpages. Here I try to use several different methods related to the course to achieve this:

Method 1: Use js to find an html-to-js website and convert the html code in your header into js Code.
Add <script language = "JavaScript" type = "text/javascript" src = "js/header. js"> </script>
The src = "js/header. js" path is the path of your head. js file.

This method can display the webpage content normally:

 

This method is convenient and easy to modify. The disadvantage is that because the search engine does not understand javascript files, the header files and tail files cannot be included by the search engine.

Method 2: Use the iframe framework

Create a common header file head.htmor a common background file foot.htm. To call the header and the bottom file, add the following code at the beginning and end of the webpage code:

<Iframe src = "head.html" width = "100%" height = "auto" marginwidth = "0" marginheight = "0" frameborder = "0" scrolling = "no"> </ iframe>

<Iframe src = "foot.html" width = "100%" height = "auto" marginwidth = "0" marginheight = "0" frameborder = "0" scrolling = "no"> </ iframe>

For this method, I don't know if my opening method is incorrect, and the display of the header is not ideal: only a straight line is displayed .. This method is not recommended.

 

Method 3: use ASP or PHP

First, create a header file head. php or a bottom file foot. php.

For example, if the homepage is index. asp, the code of calling the header is at the beginning of the code of the index. asp file (after the first mark, before the

<!–  #include file=”head.php”    –> 

The code for calling the shared bottom file is to add the following code to the end position of the index. asp file code (before the last mark:

<! -# Include file = "foot. php"->

This method is pending ..


Related Article

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.