douyun8901 2013-09-21 20:03
浏览 23
已采纳

在html设计中插入页面

i have designed one website with 20 pages and the menu and header have the css design my problem is if i change the menu content then i have to change all the page so how to make the separate page for the header.

I have tried and include page method but not work please.

Code snippet:

     <!DOCTYPE html>
     <html class=" no-bgpositionxy" xmlns="http://www.w3.org/1999/xhtml" lang="en">
        <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
           <title>sample</title>
        <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
    <script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
    <script type="text/javascript" src="js/custom.js"></script>
    <link rel="stylesheet" href="css/nivo-slider.css" type="text/css"    media="screen" />
    <script src="js/jquery.nivo.slider.js" type="text/javascript"></script>



    <link rel="shortcut icon" href="Fav.ico">
   <meta name="robots" content="follow,index">



    <link type="text/css" href="css/BodyAlign.css" rel="stylesheet" media="all">



     <script type="text/javascript" src="js/Menu.js"></script>
     <script type="text/javascript" src="js/Menu1.js"></script>

    <script type="text/javascript" src="js/MenuDrop.js" language="javascript"></script>
   <script type="text/javascript" language="javascript">
            ct = "us";
            selURL = "manufacturing.html";
            $(function(){$('#popularSearches,#country-list').hide();});
        </script>


    <style media="screen" type="text/css">
     <!--
      .enlarge {width:330px;bottom:55px;}

      --> 
     </style>


  </head>

 <!-- Head -->

  <body>

below the code is menu so i want to make separate page for below code

<header id="header"> <div class="container">   <div id="topnav_wrap"> <ul id="topnav"> <li class="topnav_column_title"> <a href="index.html">Home</a></li>

  <li id="why_workday_menu"> <a href="manufacturing.html">Why </a> <div style="width: 200px;" class="topnav_content 1-columns"> <ul class="topnav_column1 last">

<li class="topnav_column_title"> <a href="manufacturing.html">Why </a></li> <li> <a href="manufacturing.html">Designed for the Way You Work</a></li> <li> <a href="manufacturing.html">Real Cloud</a></li> <li> <a href="manufacturing.html">Mobile</a></li> <div class="clearfix"></div>
  • 写回答

4条回答 默认 最新

  • dongyue1988 2013-09-21 20:17
    关注

    You can use <object> in a non standard way like this:

    <object name="header" type="text/html" data="header.inc.html"></object>
    

    Or you can also use SSI if your server support it..

    <!--#include file="header.inc.shtml" -->
    

    If your html document can be parsed with php, you can use the include statement..

    <?php include('header.inc.phtml'); ?>
    

    Another way is to use Ajax, e.g. with jQuery:

    // if you have a container for it with id 'header-wrapper'
    $('#header-wrapper').load('header.inc.html');
    
    // ..or if you have no container for it
    $.get("header.inc.html", function(data) {
        $("body").prepend(data);
    });
    

    Last but not least you can use a Frameset or a iFrame as bad practice.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度