这是how_left.php的文件,作用是显示导航栏
注:下面的Js代码不必理会 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>馆内指南</title><style type="text/css">body{margin-left:0;}a{ text-decoration:none; color:#333333}#nav{    align:center;     border: 1px solid #7e99c6;    width:180px;     list-style:none;margin:0; padding:0    background:#fff;}#nav h4{    height:30px; cursor:pointer; padding-left:8px; margin:1px;line-height: 200%;    /*background:url(../image/7.jpg)*/ 170px 5px no-repeat #E8F5FE;}#nav div{ display:none }#nav a{    margin:1px 8px;  padding-left:15px;    display:block;height:26px; line-height: 180%;font-size:14px;    border-bottom:1px #666666 dashed; /*background: url(../image/7.jpg)*/ left -54px no-repeat}#nav a:hover,#nav a.current{    background-color:#82b0ec; background-position:left -75px;}</style><script type="text/javascript">var lastClick;var lastSubClick;window.onload=function(){    var nav = document.getElementById("nav");    nav.onclick = function (e){        var src = e? e.target:event.srcElement;        var oStyle = src.nextSibling.style;            if (src.tagName == "H4"){                                if (lastClick == src){                oStyle.display = "none";                src.style.backgroundPosition = "170px 5px";                lastClick = null;            }else{                if (lastClick){                    lastClick.nextSibling.style.display = "none";                    lastClick.style.backgroundPosition = "170px 5px";                }                oStyle.display = "block";                src.style.backgroundPosition = "170px -24px";                lastClick = src;            }        }else if(src.tagName == "A"){            if (lastSubClick){                lastSubClick.className = "";            }            src.className = "current";            lastSubClick = src;        }
        src.blur();
    }
    nav.onmouseout =  function (e){
        var src = e?e.target:event.srcElement;
        if (src.tagName == "H4"){
           src.style.backgroundColor = "#E8F5FE";
           src.style.color = "#000";
        }
    }
    nav.onmouseover = function (e){
        var src = e?e.target:event.srcElement;
        if (src.tagName == "H4"){
            src.style.backgroundColor = "#3F8CDA";
            src.style.color = "#FFF";
        }
    }
}
</script>
</head>
<body>
<?php 
require_once("../global_client.php"); //=======这个个引用文件,前面已经引用了这个文件
     $sql="select * from how_sort";
     $DB->query($sql);
    $res = $DB->get_rows_array();    
    //结果集行数
    $rows_count=count($res);    
    ?>
<table  width="81%" align="center" border="0"><tr><td width="13%">
<ul id="nav">
    <?php        
            for($i=0;$i<$rows_count;$i++)
            {
             $id = $res[$i]['sortid'];
             $name=$res[$i]['sort_name'];                
            ?>
            <li><h4><?php echo $name; ?></h4><div> 
            <?php
                //=======获取分类号的id下的所有子分类
                $sql="select * from sort_detail where sortid = ".$id; 
                $DB->query($sql);
                $result = $DB->get_rows_array();//=====注意前面是$res,这里是$result
                //结果集行数
                $rows_sum=count($result);
                for($j=0;$j<$rows_sum;$j++)
                {         
                ?>          
                <a href="./detail_show.php?id=<?php echo $result[$j]['id'];?>" ><?php  echo $result[$j]['detail_name'];?></a>
                <?php
               }//========结束第二重循环          ?>
                   </div>
              </li>  
           <?php
    }//========结束第一重循环
     ?>
           </ul>
</td>
<td>
</td>
</tr>
</table>
</body>
</html>
复制代码这是detail_show.php    结果只是显示导航栏,没有下面想要输出的内容..... <?php require("../global_client.php");
require("../client_header.html");
$id=$_GET['id'];
$sql="select * from sort_detail where id=".$id;
$res=mysql_fetch_array(mysql_query($sql));
?>
<table width="81%" align="center"  border="1">
<tr>
<td width="20%" align="left" valign="top" bgcolor=""><!--左侧一列是菜单栏-->
<?php require("./how_left.php"); ?>    <!--结果只是显示导航栏,没有下面想要输出的内容,但如果把这一行删去,内容就可以正常显示,请问这是为什么呢?-->
</td>
<td valign="top"><br /><!--这一列是子分类内容-->
<table width="100%">
<tr>
     <td align="center"><?php echo $res['detail_name']; ?>
</td>
</tr>
<tr >
<td ><br><?php echo $res['detail']; ?></td>
</tr>
</table>
</td>
</tr>
</table>
疑惑中,请您不吝指点~