自动实现站群二级栏目调用切换三级

日期: 2021-11-29 22:09:54 人气: -

<div class="qlist">

<div id="tab3">

<ul>

<? 

$query=$db->query("select * from ".$LG->table("arclass")." where menunumber like '".substr($CN,0,4)."%' and level=2 order by sortnum desc,id desc limit 10");

$i = 0;

while($rs=$db->fetchrow($query)){

?>

<li onmouseover="setTab(3,<? echo $i?>)"  <? if($i == 0) echo 'class="now"';?> ><? echo $rs["menuname"];?></li>

<? 

$i++;

}?>

<span> </span>

</ul>

</div>

<div id="tablist3">


<? 

$query=$db->query("select * from ".$LG->table("arclass")." where menunumber like '".substr($CN,0,4)."%' and level=2 order by sortnum desc,id desc limit 10");

$i = 0;

while($rs=$db->fetchrow($query)){

?>

<div class="tablist <? if($i == 0) echo 'block';?>"> 

<div class="leixing">

<dt>栏 &nbsp;&nbsp;&nbsp;目:</dt>

<dd>

<? 

$que=$db->query("select * from ".$LG->table("arclass")." where menunumber like '".$rs['menunumber']."%' and level=3 order by sortnum desc,id desc limit 10");

while($rss=$db->fetchrow($que)){

?>

<a href="<? echo getcurl($rss["id"]);?>"><? echo $rss["menuname"];?></a>

<? }

?>

</dd>

</div>

</div>

<? $i++;}?>

</div>

<script type="text/javascript"> 

function setTab(m,n){ 

var menu=document.getElementById("tab"+m).getElementsByTagName("li"); 

var div=document.getElementById("tablist"+m).getElementsByTagName("div"); 

var showdiv=[]; 

for (i=0; j=div[i]; i++){ 

if ((" "+div[i].className+" ").indexOf(" tablist ")!=-1){ 

showdiv.push(div[i]); 

} } 

for(i=0;i<menu.length;i++) { 

menu[i].className=i==n?"now":""; 

showdiv[i].style.display=i==n?"block":"none"; 

} } 

</script>

</div>