闲来无事,继续更新~要做一个有追求的版本,列表页增加树形菜单
<div style="max-width:90%" id="treediv" class="tree"></div><br /><script type="text/javascript"><br />var data=[<br /><?php<br /> $sql="select bid,count(distinct bid),max(ssort) as st from " .C('db_prefix'). "small_block group by bid order by st desc";<br /> $query=mysql_query($sql);<br /> $num=mysql_num_rows($query);<br /> if($num>0){<br /> while($arr=mysql_fetch_array($query)){<br /> $ssql="select * from " .C('db_prefix'). "big_block where id=".$arr['bid'];<br /> $squery=mysql_query($ssql);<br /> $snum=mysql_num_rows($squery);<br /> if($snum>0){<br /> while($sarr=mysql_fetch_array($squery)){<br />?><br />{t:'<?php echo $sarr['bzone']; ?>',s:[<?php <br /> $ssql2="select * from " .C('db_prefix'). "small_block where bid=".$sarr['id'];<br /> $squery2=mysql_query($ssql2);<br /> $snum2=mysql_num_rows($squery2);<br /> if($snum2>0){<br /> while($sarr2=mysql_fetch_array($squery2)){<br /> ?>{t:'<?php echo $sarr2['szone'];?>',url:'{site}/index.php/List{url}index{url}f{url}<?php echo $sarr2['id']; ?>{shtml}'},<?php<br /> }<br /> }<br /> ?><br /> ]},<?php<br /> }<br /> }<br /> }<br /> }<br /> ?><br />];<br />var et=new Tree(data,'treediv');<br />var dts=document.getElementById("treediv").getElementsByTagName("dt");<br />for(var i=0;i<dts.length;i++){<br />if(document.all) {dts[i].click();}<br />else {<br /> var e = document.createEvent("MouseEvents");<br /> e.initEvent("click", false, false);<br /> dts[i].dispatchEvent(e);<br /> }<br />}<br />var navH = document.getElementById("treediv").offsetTop;<br />window.onscroll=function(){<br /> var scroH = window.pageYOffset|| document.documentElement.scrollTop || document.body.scrollTop;<br /> if (scroH >= navH) {<br /> document.getElementById("treediv").style.position="fixed";<br /> document.getElementById("treediv").style.top=0;<br /> } else if (scroH < navH) {<br /> document.getElementById("treediv").style.position="absolute";<br /> document.getElementById("treediv").style.top="30px";<br /> }<br />}<br /></script>