日期:2014-05-17 浏览次数:20513 次
<div style="position:absolute;width:180px;overflow-x:hidden" id="treediv" class="tree"></div>
<script type="text/javascript">
var data=[
<?php
$sql="select bid,count(distinct bid),max(ssort) as st from " .C('db_prefix'). "small_block group by bid order by st desc";
$query=mysql_query($sql);
$num=mysql_num_rows($query);
if($num>0){
while($arr=mysql_fetch_array($query)){
$ssql="select * from " .C('db_prefix'). "big_block where id=".$arr['bid'];
$squery=mysql_query($ssql);
$snum=mysql_num_rows($squery);
if($snum>0){
while($sarr=mysql_fetch_array($squery)){
?>
{t:'<?php echo $sarr['bzone']; ?>',s:[<?php
$ssql2="select * from " .C('db_prefix'). "small_block where bid=".$sarr['id'];
$squery2=mysql_query($ssql2);
$snum2=mysql_num_rows($squery2);
if($snum2>0){
while($sarr2=mysql_fetch_array($squery2)){
?>{t:'<?php echo $sarr2['szone'];?>',url:'{site}/index.php/List{url}index{url}f{url}<?php echo $sarr2['id']; ?>{shtml}'},<?php
}
}
?>
]},<?php
}
}
}
}
?>
];
var et=new Tree(data,'treediv');
var dts=document.getElementById("treediv").getElementsByTagName("dt");
for(var i=0;i<dts.length;i++){
if(document.all) {dts[i].click();}
else {
var e = document.createEvent("MouseEvents");
e.initEvent("click", false, false);
dts[i].dispatchEvent(e);
}
}
var navH = document.getElementById("treediv").offsetTop;
window.onscroll=function(){
var scroH = window.pageYOffset|| document.documentElement.scrollTop || document.body.scrollTop;
if (scroH >= navH) {
document.getElementById("treediv").style.position="fixed";
document.getElementById("treediv").style.top=0;
} else if (scroH < navH) {
document.getElementById("treediv").style.position="absolute";
document.getElementById("treediv").style.top="30px";
}
}
</script>