dsstlsqt696435 2015-07-07 09:56
浏览 66

单击不同div / section上的链接后,通过html(或php)更新div / section

I would like to update a div/section of a web page as a result of clicking on a link from another section of the web page

My html code so far is like this: and I stuck on how to complete the href tags and the content section so that links are tied to the content section/division. Also is it possible for address bar to reflect the content being viewed (depending on the links clicked) rather than being stuck in address of the original web page?

Edit: Just to be clear: I would like to load html into a div upon clicking any links

<html>
<head>
<title>Example PAGE</title>
<link type="text/css" rel="Stylesheet" href="style.css" />
<script type="text/javascript" charset="utf-8" src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>

<!-- top header bar -->
<section id="header">
<div id="top_Nav" style="color: #FFFFFF; padding: 5px 5px 5px 5px;text-shadow:10px 10px 10px blue">
<font size="6"><center>Title</center></font>
</div>
</section>


<section id="Menu">
<div id="navigation">
<div id="menu">
<p<ul><font color=#FFFFFF face="Verdana, Arial, Helvetica, sans-serif"><a><b>Dashboard</b></a></font></ul>
<ul><li><font face="Verdana, Arial, Helvetica, sans-serif"><a href="./dashboard/Display_global.php"<b>Dashboard</b></a></font></ul>
<ul><li><li><font face="Verdana, Arial, Helvetica, sans-serif"><a href="./dashboard/graphs/metric_barchart.html" target="myContent"><b>MDV Bar Chart</b></a></font></ul>
    </p>

<p<ul><font color=#FFFFFF face="Verdana, Arial, Helvetica, sans-serif"><a><b>Spitfire I</b></a></font></ul>
            <ul><li><font face="Verdana, Arial, Helvetica, sans-serif"><a href="qaweb_sf1/codec/Codec.php" target="myContent"><b>Sfcodec</a></font></ul>
            <ul><li><font face="Verdana, Arial, Helvetica, sans-serif"><a href="qaweb_sf1/ats/ats.html" target="myContent">Spitfire I - ATS</a></font></ul>
    <ul><li><font face="Verdana, Arial, Helvetica, sans-serif"><a href="qaweb_sf1/latest_sf1dac.html" target="myContent">SF1 DAC</a></font></ul>
    <ul><li><li><font face="Verdana, Arial, Helvetica, sans-serif"><a href="qaweb_sf1/dac_db/Dac.php" target="myContent">SF1 DAC DB</a></font></ul>
    <ul><li><li><font face="Verdana, Arial, Helvetica, sans-serif"><a href="qaweb_sf1/decoder/Front.php" target="myContent">SF1 Decoder</a></font></ul>
 </div>
 </div>

 </section>

 <section id=Content>
 <div id="content"> Some content
 </div>
 </section>
 </body>
 </html>
  • 写回答

1条回答 默认 最新

  • douxi1738 2016-01-29 16:23
    关注

    This is how I resolved it:

    <?php   
     $page_title = "page title";
     $css_link = '<link type="text/css" rel="Stylesheet" href="../css/style.css"/>';
     include_once($_SERVER['DOCUMENT_ROOT'] . "/banner.php");
    ?>
    
    <section id="Menu">
    <div id="navigation">
    <div id="menu">
      <?php include($_SERVER['DOCUMENT_ROOT'] . "/Menu.php");
        ?>
    </div>
    </div>
    </secion>
    <section id="Content">
    <div id="content">
    <base target="_blank" />
    </div>
    </section>
    </body>
    </html>
    

    And now I have changed all the pages to .php and have the following template:

    <?php   
     $page_title = "soemthing to set page title by top_nav";
     $css_link = '<link type="text/css" rel="Stylesheet" href="../../css/style.css"/>';
     include_once($_SERVER['DOCUMENT_ROOT'] . "/banner.php");
    ?>
    <section id="Menu">
    <div id="navigation">
    <div id="menu">
    <?php 
      include_once($_SERVER['DOCUMENT_ROOT'] . "/Menu.php");
    ?>
    </div>
    </div>
    </secion>
    <section id="Content">
    <div id="content">
    <br>
    Content Here!
    </div>
    </section>
    </body>
    </html>
    

    So now I am reloading everything but the look and feel is mantained, so for a small website, it probably is adequate but I hope there is a more elegant solution to this.

    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line