zl程序教程

您现在的位置是:首页 >  后端

当前栏目

PHP向右侧拉菜单实现代码,测试使用中

PHP测试代码 实现 使用 菜单 右侧
2023-06-13 09:14:13 时间
这个是由asp二级侧拉菜单改的
复制代码代码如下:

<scriptlanguage="javascript">
//JavaScriptDocument

startList=function(){
if(document.all&&document.getElementById){
navRoot=document.getElementById("nav");
for(i=0;i<navRoot.childNodes.length;i++){
node=navRoot.childNodes[i];
if(node.nodeName=="LI"){
node.onmouseover=function(){
this.className+="over";
}
node.onmouseout=function(){
this.className=this.className.replace("over","");
}
}
}
}
}
window.onload=startList;
</script>

<styletype="text/css">
<!--
ul{
margin:0;
padding:0;
list-style:none;
width:200px;/*WidthofMenuItems*/
border-bottom:0pxsolid#ccc;
}
ulli{
position:relative;
}
liul{
position:absolute;
left:199px;/*Set1pxlessthanmenuwidth*/
top:0;
display:none;

}
/*StylesforMenuItems*/
ullia{
display:block;
text-decoration:none;
color:#777;
background:#8A0000;/*IE6Bug*/
padding:5px;
border:0px#ccc;/*IE6Bug*/
border-bottom:0;
}
/*HollyHack.IERequirement\*/
*htmlulli{float:left;height:1%;}
*htmlullia{height:1%;}
/*End*/
li:hoverul,li.overul{display:block;}/*Themagic*/
.ulbox{border:1pxsolid#ffffff;overflow:hidden;margin-left:1px;background-color:#E87DDD}
-->
</style>
<tablewidth="200"cellspacing="0"cellpadding="0"border="0"align="center">
<tr>
<tdalign="left">
<ulid="nav">
<?php
require("../Connections/lr.php");
mysql_select_db($database_lr,$lr);

$query=mysql_query("SELECT*FROMbigclassorderbysort");
$j=0;
while($row=mysql_fetch_array($query))
{$j=$j+1;
$bigclassid=$row["bigclassid"];
$bigclassname_leftmenu=$row["bigclassname"];
if($htmlname==1){
$bigclass_htmlname_leftmenu=$bigclassname_leftmenu;//大类名称
if(substr_count($bigclass_htmlname_leftmenu,"")>0){
$bigclass_htmlname_leftmenu=str_replace("","-",$bigclass_htmlname_leftmenu);
}
}
if($htmlname==0){
$bigclass_htmlname_leftmenu=$bigclassid;
}
?>
<li><ahref=""><?phpecho$row["bigclassname"]?></a>
<ulclass="ulbox">
<?php
mysql_select_db($database_lr,$lr);
$query_small=mysql_query("SELECT*FROMsmallclasswherebigclassid="$bigclassid"orderbysort");
while($rs=mysql_fetch_array($query_small))


{
$smallclassid_small_leftmenu=$rs["smallclassid"];
$smallclassname_small=$rs["smallclassname"];//小类名称

if($htmlname==1){
$smallclass_htmlname=$smallclassname_small;
if(substr_count($smallclass_htmlname,"")>0){
$smallclass_htmlname=str_replace("","-",$smallclass_htmlname);
}
}
if($htmlname==0){
$smallclass_htmlname=$smallclassid_small_leftmenu;
}

?>

<li><ahref=""class="my2"><?phpecho$rs["smallclassname"]?></a></li>
<?php
}?>
</ul>

</li>
<?php
}?>
</ul>
</td></tr></table>