当前位置: 首页 > 图文教程 > 网络编程 > PHP > PHP 向右侧拉菜单实现代码,测试使用中

PHP
PHP 变量类型的强制转换
PHP 判断变量类型实现代码
PHP 数组教程 定义数组
php后台程序与Javascript的两种交互方式
php 文件上传系统手记
php 网页游戏开发入门教程一(webgame+design)
PHP 简单日历实现代码
dedecms 批量提取第一张图片最为缩略图的代码(文章+软件)
php 显示指定路径下的图片
php pack与unpack 摸板字符字符含义
ThinkPHP php 框架学习笔记
PHP 批量删除数据的方法分析
PHP 读取和修改大文件的某行内容的代码
php实现jQuery扩展函数
浅谈PHP 闭包特性在实际应用中的问题
PHP 文件上传源码分析(RFC1867)
php 攻击方法之谈php+mysql注射语句构造
PHP+MySQL 手工注入语句大全 推荐
php UTF8 文件的签名问题
php 远程包含文件漏洞分析

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-10   浏览: 50 ::
收藏到网摘: n/a

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>