当前位置: 移动技术网 > IT编程>开发语言>PHP > PHP 向右侧拉菜单实现代码,测试使用中

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

2019年05月03日  | 移动技术网IT编程  | 我要评论
这个是由asp二级侧拉菜单改的
复制代码 代码如下:

<script language="javascript">
// javascript document

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>

<style type="text/css">
<!--
ul {
margin: 0;
padding: 0;
list-style: none;
width: 200px; /* width of menu items */
border-bottom: 0px solid #ccc;
}
ul li {
position: relative;
}
li ul {
position: absolute;
left: 199px; /* set 1px less than menu width */
top: 0;
display: none;

}
/* styles for menu items */
ul li a {
display: block;
text-decoration: none;
color: #777;
background: #8a0000; /* ie6 bug */
padding: 5px;
border: 0px #ccc; /* ie6 bug */
border-bottom: 0;
}
/* holly hack. ie requirement \*/
* html ul li { float: left; height: 1%; }
* html ul li a { height: 1%; }
/* end */
li:hover ul, li.over ul { display: block; } /* the magic */
.ulbox{border:1px solid #ffffff;overflow:hidden;margin-left:1px;background-color:#e87ddd}
-->
</style>
<table width="200" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td align="left">
<ul id="nav">
<?php
require('../connections/lr.php');
mysql_select_db($database_lr, $lr);

$query = mysql_query("select * from bigclass order by sort");
$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><a href=""><?php echo $row['bigclassname']?></a>
<ul class="ulbox">
<?php
mysql_select_db($database_lr, $lr);
$query_small = mysql_query("select * from smallclass where bigclassid='$bigclassid' order by sort");
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><a href="" class="my2"><?php echo $rs['smallclassname']?></a></li>
<?php
} ?>
</ul>

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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网