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

yipeiwu_com6年前PHP代码库
这个是由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>

相关文章

PHP字符串中抽取子串操作实例分析

本文实例讲述了PHP字符串中抽取子串操作。分享给大家供大家参考,具体如下: 问题 希望从字符串的某个特定位置开始抽取这个字符串的一部分。例如,对于输入到一个表单的用户名,想要得到这个用...

php比较多维数组中值的大小排序实现代码

如果值没有重复的情况,可以先用array_flip()来交换键和值,然后krsort(),最后再array_flip()交换回来,就可以比较大小了。如果要截取数组,可用array_sli...

php匹配字符中链接地址的方法

本文实例讲述了php匹配字符中链接地址的方法。分享给大家供大家参考。具体如下: 判断一个字符串是否含有超级链接,代码如下: 复制代码 代码如下:$str="ssdsf<a targ...

php使用ob_start()实现图片存入变量的方法

本文实例讲述了php使用ob_start()实现图片存入变量的方法。分享给大家供大家参考。具体实现方法如下: 用php的GD库处理完图片后,只能将图片用imagejpeg()输出,或者写...

php split汉字

第一种办法: 加载 Encode模块,前提是你需要安装这个模块 例子代码: 复制代码 代码如下: $str=decode("gb2312",$names[$index]); @chars...