包括一个HTML文件到另一个 [英] including one html file into another

查看:104
本文介绍了包括一个HTML文件到另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想包含一个html文件到另一个,但似乎没有解决
这两个文件是
C:/wamp/www/AuctionVilla/index.html

C:/wamp/www/AuctionVilla/header.html

这是我的index.html文件

 < html xmlns =http://www.w3.org/1999/xhtml> 
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = iso-8859-1/>
< title>无标题文档< / title>
< link rel =stylesheettype =text / cssmedia =screenhref =CSS / style.css/>
< / head>

< body>
< div id =index_container>
< table align =center>
< tr>
< td>
< table width =1000pxalign =centercellpadding =0cellspacing =0border =0>
< tr>
< td colspan =3>
<! - #include virtual =C:/wamp/www/AuctionVilla/header.html - >
< / td>
< / tr>
< tr>
< td colspan =3>& nbsp
< / td>
< / tr>
< tr>
< td width =350px>
< / td>
< td width =5pxrowspan =3>& nbsp
< / td>
< td width =650pxrowspan =3>
< div id =product_containerclass =divcontainerstyle =width:645px; height:500px;>
< / div>
< / td>
< / tr>
< tr>
< td width =350pxheight =5px>
< / td>
< / tr>
< tr>
< td width =350pxheight =355px>
< div id =movie_containerclass =divcontainerstyle =width:350px; height:355px;>
< / div>
< / td>
< / tr>
< / table>
< / td>
< / tr>
< / table>
< / div>
< / body>
< / html>

以下是我的header.html文件

 < html xmlns =http://www.w3.org/1999/xhtml> 
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = iso-8859-1/>
< title>标题< /标题>
< link rel =stylesheettype =text / cssmedia =screenhref =CSS / headerMenu.css/>
< / head>

< body>
< div id =main_body>
< div>
< table cellpadding =0cellspacing =0border =0>
< tr>
< td>
< object classid =clsid:1codebase =../ UAuction / Images / matrimony.swfwidth =1000height =228>
< param name =Images / matrimony.swf/>
< param name =qualityvalue =high/>
< embed src =../ UAuction / Images / matrimony.swfquality =high
pluginspage =http://www.macromedia.com/go/getflashplayer
type =application / x-shockwave-flashwidth =1000height =228wmode =transparent>
< / embed>
< / object>
< / td>
< / tr>
< / table>
< / div>
< br />
< div id =topmenu>
< table align =centerbgcolor =#000000>
< tr>
< td>
< ul id =css3menu>
< li>< a href =../ UAuction / index.php>& nbsp Home< / a>< / li>
< li>< a href =#>& nbsp分类< / a>
< ul>
< li>< a href =#> Art< / a>
< ul>
< li>< a href =#>绘画< / a>< / li>
< li>< a href =#>雕塑< / a>< / li>
< / ul>
< / li>
< li>< a href =#>图书< / a>
< ul>
< li>< a href =#>预订< / a>< / li>
< li>< a href =#>纪录片< / a>< / li>
< / ul>
< / li>
< li>< a href =#>家具< / a>
< ul>
< li>< a href =#>主席< / a>< / li>
< li>< a href =#>衣柜< / a>< / li>
< li>< a href =#>表< / a>< / li>
< / ul>
< / li>
< li>< a href =#>体育用品< / a>
< ul>
< li>< a href =#>板球< / a>< / li>
< li>< a href =#>足球< / a>< / li>
< li>< a href =#>橄榄球< / a>< / li>
< / ul>
< / li>
< / ul>
< / li>
< li>< a href =../ UAuction / register.php>& nbsp注册< / a>< / li>
< li>< a href =#>& nbsp热门投标者< / a>< / li>
< li>< a href =#>& nbsp畅销商< / a>< / li>
< li>< a href =../ UAuction / contact_us.php>& nbsp联络我们< / a>
< ul>
< li>< a href =#>合作伙伴< / a>< / li>
< li>< a href =#>办公室< / a>< / li>
< / ul>
< / li>
< li>< a href =../ UAuction / about_us.php>关于我们& nbsp< / a>< / li>
< / ul>
< / td>
< / tr>
< / table>
< / div>
< / div>
< script src =../ UAuction / JQUERY / jquery.min.jstype =text / javascriptcharset =utf-8>< / script>
< script src =../ UAuction / JQUERY / jquery.effects.core.jstype =text / javascript>< / script>
< script type =text / javascriptsrc =../ UAuction / JQUERY / script.js>< / script>
< / body>
< / html>

我似乎错了,但它不是我的工作...



我试图将html更改为shtml,但文件并不包含在内。

解决方案

 < p>如果您的服务器上只有HTML,或者您只需要HTML文件,则可以使用框架。框架集合行=25%,75%> 
< frame src =header.html/>
< frame src =index.html/>
< / frameset>

iframes 像这样(在 index.html 文件):

 < iframe src =标题。 html/> 

但是,不建议这样做,因为它会创建一种表格。如果你的服务器上有PHP,创建一个PHP文件,并使用

  include(header.html); 

如果您的网络服务器上安装了SSI(服务器端包含),那么请输入:

 <! - #include virtual =header.html - > 

个人而言,我建议您使用PHP方法。


i want to include one html file into another, but it doesnt seem to work out the two files are C:/wamp/www/AuctionVilla/index.html and C:/wamp/www/AuctionVilla/header.html

here's my index.html file

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
 <link rel="stylesheet" type="text/css" media="screen" href="CSS/style.css" />
</head>

<body>
<div id="index_container">
<table align="center">
<tr>
<td>
    <table width="1000px" align="center" cellpadding="0" cellspacing="0" border="0">
       <tr>
       <td colspan="3">
          <!--#include virtual="C:/wamp/www/AuctionVilla/header.html" -->
       </td>
       </tr>
       <tr>
       <td colspan="3">&nbsp
       </td>
       </tr>
       <tr>
       <td width="350px">
       </td>
       <td width="5px" rowspan="3">&nbsp
       </td>
       <td width="650px" rowspan="3">
          <div id="product_container" class="divcontainer" style="width: 645px; height: 500px;">
          </div>
        </td>
        </tr>
        <tr>
        <td width="350px" height="5px">
        </td>
        </tr>   
        <tr>
        <td width="350px" height="355px">
           <div id="movie_container" class="divcontainer" style="width: 350px; height: 355px;">
          </div>
        </td>
        </tr>     
    </table>      
</td>
</tr>
</table>
</div>
</body>
</html>

and here's my header.html file

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>header</title>
<link rel="stylesheet" type="text/css" media="screen" href="CSS/headerMenu.css" />
</head>

<body>
<div id="main_body">
    <div>
      <table cellpadding="0" cellspacing="0" border="0">
      <tr>
      <td>
         <object classid="clsid:1" codebase="../UAuction/Images/matrimony.swf" width="1000" height="228">
         <param name="Images/matrimony.swf" />
         <param name="quality" value="high" />
         <embed src="../UAuction/Images/matrimony.swf" quality="high" 
         pluginspage="http://www.macromedia.com/go/getflashplayer" 
         type="application/x-shockwave-flash" width="1000" height="228" wmode="transparent">
         </embed>
         </object>
      </td>
      </tr>
      </table>
    </div>
    <br/>
    <div id="topmenu">
    <table align="center" bgcolor="#000000">
     <tr> 
     <td>
   <ul id="css3menu">
        <li><a href="../UAuction/index.php">&nbsp Home</a></li>
        <li><a href="#">&nbsp Category</a>
        <ul>
            <li><a href="#">Art</a>
                 <ul>
                    <li><a href="#">Paintings</a></li>
                    <li><a href="#">Sculptures</a></li>
                 </ul>
            </li>    
            <li><a href="#">Books</a>
                 <ul>
                    <li><a href="#">Book</a></li>
                    <li><a href="#">Documentaries</a></li>
                 </ul>
            </li>    
            <li><a href="#">Furniture</a>
                <ul>
                    <li><a href="#">Chair</a></li>
                    <li><a href="#">Wardrobe</a></li>
                    <li><a href="#">Table</a></li>                       
                </ul>
            </li>   
            <li><a href="#">Sport Goods</a>
                 <ul>
                    <li><a href="#">Cricket</a></li>
                    <li><a href="#">Football</a></li>
                    <li><a href="#">Rugby</a></li>                       
                </ul>
            </li>   
        </ul>
    </li>
    <li><a href="../UAuction/register.php">&nbsp Register</a></li>
    <li><a href="#">&nbsp Top Bidders</a></li> 
    <li><a href="#">&nbsp Top Sellers</a></li>
    <li><a href="../UAuction/contact_us.php">&nbsp Contact Us</a>
        <ul>
            <li><a href="#">Partners</a></li>
            <li><a href="#">Offices</a></li>                       
        </ul>
    </li>    
    <li><a href="../UAuction/about_us.php">About Us &nbsp</a></li>     
</ul> 
     </td>
     </tr>
    </table>                 
    </div>
</div>
<script src="../UAuction/JQUERY/jquery.min.js" type="text/javascript" charset="utf-8"></script>   
<script src="../UAuction/JQUERY/jquery.effects.core.js" type="text/javascript"></script>
<script type="text/javascript" src="../UAuction/JQUERY/script.js"></script> 
</body>
</html>

i dnt knw whta seems to wrong, but it isnt workking fr me...

i tried to change the html to shtml but the file doesnt include at all..

解决方案

If you only have HTML on your server, or you need only HTML files, you can use frames.

<frameset rows="25%,75%">
  <frame src="header.html" />
  <frame src="index.html" />
</frameset>

or iframes like this (in your index.html file):

<iframe src="header.html" />

But, it is not recommended as it creates a kind of table. If you have PHP on your server, create a PHP file, and use

include("header.html");

If you have SSI (Server Side Includes) on your webserver, then have this:

<!--#include virtual="header.html" -->

Personally, I suggest you to use PHP method.

这篇关于包括一个HTML文件到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆