PHP 向右側(cè)拉菜單實(shí)現(xiàn)代碼,測(cè)試使用中
更新時(shí)間:2009年11月03日 23:41:30 作者:
PHP 向右側(cè)拉菜單實(shí)現(xiàn)代碼,測(cè)試使用中,需要的朋友可以測(cè)試下。
這個(gè)是由asp二級(jí)側(cè)拉菜單改的
<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;//大類(lèi)名稱(chēng)
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'];//小類(lèi)名稱(chēng)
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>
復(fù)制代碼 代碼如下:
<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;//大類(lèi)名稱(chēng)
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'];//小類(lèi)名稱(chēng)
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 三級(jí)聯(lián)動(dòng)菜單
- jQuery+PHP+MySQL二級(jí)聯(lián)動(dòng)下拉菜單實(shí)例講解
- ThinkPHP使用心得分享-ThinkPHP + Ajax 實(shí)現(xiàn)2級(jí)聯(lián)動(dòng)下拉菜單
- 落伍首發(fā) php+mysql 采用ajax技術(shù)的 省 市 地 3級(jí)聯(lián)動(dòng)無(wú)刷新菜單 源碼
- php創(chuàng)建無(wú)限級(jí)樹(shù)型菜單
- 基于遞歸實(shí)現(xiàn)的php樹(shù)形菜單代碼
- PHP導(dǎo)航下拉菜單的實(shí)現(xiàn)如此簡(jiǎn)單
- PHP無(wú)限分類(lèi)代碼,支持?jǐn)?shù)組格式化、直接輸出菜單兩種方式
- php側(cè)拉菜單 漂亮,可以向右或者向左展開(kāi),支持FF,IE
- 用PHP實(shí)現(xiàn)多級(jí)樹(shù)型菜單
- PHP+JS三級(jí)菜單聯(lián)動(dòng)菜單實(shí)現(xiàn)方法
相關(guān)文章
phpmailer發(fā)送gmail郵件實(shí)例詳解
本篇文章是對(duì)phpmailer發(fā)送gmail郵件實(shí)例進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-06-06
php+ajax實(shí)現(xiàn)圖片文件上傳功能實(shí)例
目前常用的異步文件上傳功能有幾種,比較多見(jiàn)的如使用iframe框架形式,ajax功能效果,以及flash+php功能,需要的朋友可以參考下2014-06-06
PHP FileSystem 文件系統(tǒng)常用api整理總結(jié)
這篇文章主要介紹了PHP FileSystem 文件系統(tǒng)常用api,結(jié)合實(shí)例形式整理總結(jié)了php文件系統(tǒng)常用函數(shù)的功能、使用技巧與相關(guān)操作注意事項(xiàng),需要的朋友可以參考下2019-07-07
php做下載文件的實(shí)現(xiàn)代碼及文件名中亂碼解決方法
php做下載文件的實(shí)現(xiàn)代碼及文件名中亂碼解決方法,需要的朋友可以參考下。2011-02-02
PHP swoole和redis異步任務(wù)實(shí)現(xiàn)方法分析
這篇文章主要介紹了PHP swoole和redis異步任務(wù)實(shí)現(xiàn)方法,結(jié)合具體實(shí)例形式對(duì)比分析了swoole和redis異步任務(wù)具體實(shí)現(xiàn)方法及區(qū)別,需要的朋友可以參考下2019-08-08
一個(gè)完整的PHP類(lèi)包含的七種語(yǔ)法說(shuō)明
這篇文章主要介紹了一個(gè)完整的PHP類(lèi)包含的七種語(yǔ)法說(shuō)明,這些語(yǔ)法包括屬性、靜態(tài)屬性、方法、靜態(tài)方法、類(lèi)常量、構(gòu)造函數(shù)、析構(gòu)函數(shù),本文一一給代碼示例和詳細(xì)注解讓你快速了解類(lèi)的寫(xiě)法,需要的朋友可以參考下2015-06-06

