澳门新浦京8455com无限级别菜单的实现

澳门新浦京8455com ,?/*
见到大多爱人问过极端品级菜单的的标题,小编已经用相当提供的代码写出来过极端级其余菜单,然而感到效果不是很好,于是趁着清幽就写那一个自由级其余美食做法,其实道理异常粗略,主假使数据表的准备,还会有递归方法的行使,小编会在上面给出数据构造的兼备,这里小编从没加多竖直的虚线,同有时候Sql语句小编也将其向来,我们能够依赖本身的要求来改革!纵然有标题能够联系本身:msn:banneryue@sina.com,QQ:7665656,E_mail:yuepengfei@mail.banner.com.cn前日我会提供一个测量试验页面让大家来看*//**
递归突显子节点函数* ** @param $SearchPattern查找的条件* @param
$BaseNum 节点的层数*/function
ListChildTree($SearchPattern,$BaseNum卡塔尔(قطر‎{global
$Tree;//评释连接数据库的句柄为大局$Sql=select
DepartmentId,DepartmentName from test where DepartmentId like
‘$SearchPattern’;//查找孩子节点$QueryChild=$Tree-query($SqlState of Qatar;while($Result=$Tree-fetch_array($QueryChild卡塔尔国State of Qatar{
//抽出孩子节点$Space=;for($j=0;$j((strlen($SearchPattern卡塔尔/3卡塔尔(قطر‎-$BaseNumState of Qatar;$j++卡塔尔$Space.=;//设置突显节点后面包车型客车相距,这里的空格的html被这里自行替换到了$ChildDepartment=trim($Result[0]).___;$ChildSql=select
count(*State of Qatar from test where DepartmentId like
‘$ChildDepartment’;//查找孩子节点的儿女节点$ChildResult=$Tree-query_first($ChildSql);$TableId=ta.trim($Result[0]卡塔尔;
//设置表格Id$TablePic=ta.trim($Result[0]卡塔尔国.pic;//设置图片Idif($ChildResult[0]1卡塔尔国{//若无找到孩子节点的节点,则彰显-图片?trtd?=$Space?span
align=absmiddleimg src=leaf.gif border=0 align=absmiddle width=35
height=17/spanfont size=2A
href=process.php?SearchPattern=?=trim($Result[0])?
class=F1?=$Result[1]?/a/fonttable id=?=$TableId? style=display=none
cellspacing=0 cellpadding=0?}else{//找到则显示+图片?trtd?=$Space?a
onclick=javascript:expands(‘?=$TableId?’,’?=$TablePic?’卡塔尔(قطر‎style=cursor:handspan align=absmiddleimg id=?=$TablePic? src=parent.gif
border=0 align=absmiddle width=35 height=17/span/afont size=2A
href=process.php?SearchPattern=?=trim($Result[0])?
class=F1?=$Result[1]?/a/fonttable id=?=$TableId? style=display=none
cellspacing=0
cellpadding=0?ListChildTree($ChildDepartment,$BaseNum卡塔尔;//递归调用函数自身来呈现其它男女节点}//end
if?/table?}//end while}//end
function?htmlheadtitleInfiniti级菜单测量试验/titlemeta content=text/html;
charset=gb2312link rel=stylesheet href=../text.css type=text/cssscript
language=javascriptfunction expands(expid,picidState of Qatar//展现图片张合的Js{//alert(this.document.all[+expid+].style.display);if(this.document.all[expid].style.display==none){
this.document.all[expid].style.display=block;this.document.all[picid].src=leaf.gif;}else{this.document.all[expid].style.display=none;this.document.all[picid].src=parent.gif;}}/script/headbody
bgcolor=#FFFFFF text=#000000?require(do_mySql.php);$Tree = new
DB_Sql;$Tree-connect(卡塔尔国;//连接数据库,可遵照必要换到团结的代码$Sql=select
DepartmentId,DepartmentName from test where
length(DepartmentId卡塔尔(قطر‎=3;//提议最上层节点,遵照需求团结改良$Result=$Tree-query_first($Sql);?div
align=centercentertable border=1 cellpadding=0 cellspacing=0 width=766
bordercolor=#DDCF90 height=392trtd valign=topdiv align=centertable
border=0 cellpadding=0 cellspacing=0 width=372trtd width=368a
onclick=javascript:expands(‘dwtop’,’dwimg’) style=cursor:handspan
align=absmiddle img id=dwimg SRC=parent.gif border=0 align=absmiddle
width=35 height=17/span/afont size=2a
href=process.php?SearchPattern=?=$Result[0]??=$Result[1]?/a/fonttable
id=dwtop style=display=none cellspacing=0
cellpadding=0?$FirstDepartment=$Result[0];$BaseNum=strlen($FirstDepartmentState of Qatar/3;//计算层数,其实那么些有一点点多余,因为其必为率先层$SearchPattern=$FirstDepartment.___;//设置查找条件ListChildTree($Search帕特tern,$BaseNum卡塔尔;//展现祖宗节点的孩子节点?/table/td/tr/table/div/td/tr/table/center/div/body/html?/*
表布局的规划由于是测量检验表设计得不行的粗略:CREATE TABLE test (id
mediumint(8State of Qatar unsigned NOT NULL auto_increment, #流水号DepartmentId
varchar(100) NOT NULL default ”,#单位代号DepartmentName varchar(100)NOT NULL default ”,#单位名称KEY id
(idState of Qatar卡塔尔国数据插入的代码小编在此边就不那出来给大家了数据表的平整为:001为第超级001001为001的第三个头节点,001002为001的第一个子节点001001001为001001的首先身形节点,就那样推算……笔者这里只设置了一个祖先(001State of Qatar,所以在前后相继中就一向调用了,可借助须要谐和来安装,并对代码作简单的改善就能够!好了,就到那边了,借使大家有标题迎接和自家研商!最佳祝大家明日工作欢娱!先吸颗烟在上床!好累!*/?

<script language=”JavaScript”> var st=new Array(0,0,0,0); function
openclose(tree,img,i){ if(st[i]==0)
{tree.style.display=”block”;img.src=”/upload/52/open.gif”;st[i]=1;}
else
{tree.style.display=”none”;img.src=”/upload/52/close.gif”;st[i]=0;}}
document.write(‘<table style=”font:9pt 宋体” width=”200″ border=”0″
cellspacing=”0″ cellpadding=”0″>’);
document.write(‘<tr><td><a style=”cursor:hand”
onclick=”openclose(menu1,img_menu1,1);”><img
src=”/upload/52/close.gif” width=”33″ height=”15″ align=”absmiddle”
border=”0″ name=”img_menu1″></a><a href=””
target=””>网络隧道</a></td></tr>’State of Qatar;
document.write(‘<tr align=”right” valign=”top”><td>’卡塔尔(قطر‎;
document.write(‘<table id=”menu1″ style=”display:none;font:9pt 钟鼓文”
width=”180″ border=”0″ cellspacing=”0″ cellpadding=”0″>’卡塔尔(قطر‎;
document.write(‘<tr><td><a style=”cursor:hand”
onclick=”openclose(menu2,img_menu2,2);”><img
src=”/upload/52/close.gif” width=”33″ height=”15″ align=”absmiddle”
border=”0″ name=”img_menu2″></a><a href=””
target=””>网页特效</a></td></tr>’State of Qatar;
document.write(‘<tr align=”right” valign=”top”><td>’卡塔尔(قطر‎;
document.write(‘<table id=”menu2″ style=”display:none;font:9pt 钟鼓文”
width=”160″ border=”0″ cellspacing=”0″ cellpadding=”0″>’卡塔尔;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu7″></a><a
href=”” target=””>窗口页面</a></td></tr>’卡塔尔国;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu15″></a><a
href=”” target=””>菜单导航</a></td></tr>’卡塔尔;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu16″></a><a
href=”” target=””>文字特效</a></td></tr>’卡塔尔国;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu17″></a><a
href=”” target=””>媒体图象</a></td></tr>’卡塔尔国;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu18″></a><a
href=”” target=””>鼠标键盘</a></td></tr>’卡塔尔;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu19″></a><a
href=”” target=””>时间日期</a></td></tr>’State of Qatar;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu20″></a><a
href=”” target=””>别的特效</a></td></tr>’卡塔尔;
document.write(‘</table></td></tr>’卡塔尔国;document.write(‘<tr><td><a
style=”cursor:hand” onclick=”openclose(menu3,img_menu3,3);”><img
src=”/upload/52/close.gif” width=”33″ height=”15″ align=”absmiddle”
border=”0″ name=”img_menu3″></a><a href=””
target=””>本事文书档案</a></td></tr>’卡塔尔国;
document.write(‘<tr align=”right” valign=”top”><td>’卡塔尔(قطر‎;
document.write(‘<table id=”menu3″ style=”display:none;font:9pt 行书”
width=”160″ border=”0″ cellspacing=”0″ cellpadding=”0″>’卡塔尔国;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu8″></a><a
href=”” target=””>计算机才具</a></td></tr>’卡塔尔;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu21″></a><a
href=”” target=””>网页制作</a></td></tr>’卡塔尔;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu22″></a><a
href=”” target=””>网络编制程序</a></td></tr>’卡塔尔;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu23″></a><a
href=”” target=””>安全才能</a></td></tr>’卡塔尔(قطر‎;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu24″></a><a
href=”” target=””>程序人生</a></td></tr>’卡塔尔;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu25″></a><a
href=”” target=””>互联网看点</a></td></tr>’State of Qatar;
document.write(‘</table></td></tr>’卡塔尔国;document.write(‘<tr><td><a
style=”cursor:hand” onclick=”openclose(menu4,img_menu4,4);”><img
src=”/upload/52/close.gif” width=”33″ height=”15″ align=”absmiddle”
border=”0″ name=”img_menu4″></a><a href=””
target=””>笑话空间</a></td></tr>’卡塔尔(قطر‎;
document.write(‘<tr align=”right” valign=”top”><td>’卡塔尔;
document.write(‘<table id=”menu4″ style=”display:none;font:9pt 燕体”
width=”160″ border=”0″ cellspacing=”0″ cellpadding=”0″>’State of Qatar;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu9″></a><a
href=”” target=””>小孩子笑话</a></td></tr>’卡塔尔国;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu26″></a><a
href=”” target=””>学园幽默</a></td></tr>’卡塔尔;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu27″></a><a
href=”” target=””>夫妻爱情</a></td></tr>’卡塔尔;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu28″></a><a
href=”” target=””>朋友交往</a></td></tr>’卡塔尔;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu29″></a><a
href=”” target=””>精粹话语</a></td></tr>’卡塔尔国;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu30″></a><a
href=”” target=””>军事政治</a></td></tr>’卡塔尔国;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu31″></a><a
href=”” target=””>纯属笑话</a></td></tr>’);
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu32″></a><a
href=”” target=””>其它类型</a></td></tr>’State of Qatar;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu33″></a><a
href=”” target=””>生意职场</a></td></tr>’卡塔尔(قطر‎;
document.write(‘</table></td></tr>’卡塔尔(قطر‎;document.write(‘<tr><td><a
style=”cursor:hand” ><img src=”/upload/52/blank.gif” width=”33″
height=”15″ align=”absmiddle” border=”0″
name=”img_menu5″></a><a href=””
target=””>好笑图片</a></td></tr>’卡塔尔;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu6″></a><a
href=”” target=””>下载专区</a></td></tr>’卡塔尔;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu12″></a><a
href=”” target=””>查询系统</a></td></tr>’State of Qatar;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu13″></a><a
href=”” target=””>在线服务</a></td></tr>’卡塔尔(قطر‎;
document.write(‘<tr><td><a style=”cursor:hand”
><img src=”/upload/52/blank.gif” width=”33″ height=”15″
align=”absmiddle” border=”0″ name=”img_menu14″></a><a
href=”” target=””>在线娱乐</a></td></tr>’卡塔尔(قطر‎;
document.write(‘</table>’卡塔尔国; </script>

[Ctrl+A 全部筛选 提醒:你可先更改部分代码,再按运维]

You can leave a response, or trackback from your own site.

Leave a Reply

网站地图xml地图