PHP导航下拉菜单的实现对于很多朋友来说还是有一定的难度的,下面有个不错的示例,感兴趣的朋友可以参考下,希望对大家有所帮助
复制代码 代码如下:
<style>
#sddm li a:hover
{ background: #49A3FF}
#sddm div
{ position: absolute;
visibility: hidden;
margin: 0;
padding: 0;
background: #EAEBD8;
border: 1px solid #5970B2}
#sddm div a
{ position: relative;
display: block;
margin: 0;
padding: 5px 10px;
width: auto;
white-space: nowrap;
text-align: left;
text-decoration: none;
background: #EAEBD8;
color: #2875DE;
font: 12px arial}
#sddm div a:hover
{ background: #49A3FF;
color: #FFF}
</style>
<!-- dd menu -->
<script type="text/javascript">
<!--
var timeout = 500;
var closetimer = 0;
var ddmenuitem = 0;
// open hidden layer
function mopen(id)
{
// cancel close timer
mcancelclosetime();
// close old layer
if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
// get new layer and show it
ddmenuitem = document.getElementById(id);
ddmenuitem.style.visibility = 'visible';
}
// close showed layer
function mclose()
{
if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}
// go close timer
function mclosetime()
{
closetimer = window.setTimeout(mclose, timeout);
}
// cancel close timer
function mcancelclosetime()
{
if(closetimer)
{
window.clearTimeout(closetimer);
closetimer = null;
}
}
// close layer when click-out
document.onclick = mclose;
// -->
</script>
<div>
<div> <img src="https://www.jb51.net/images/logo.jpg" /> <span>服务热线<br />
400-691-6006</span> <span> <a href="https://u.youku.com/user_show/id_UMzMxNDI5MTgw.html" target="_blank"><img src="https://www.jb51.net/images/top_pic01.jpg" /></a>
<div> <a href="https://weibo.com/tcdd" target="_blank"><img src="https://www.jb51.net/images/top_pic02.jpg" /></a></div>
</span>
<ul>
<li><a href="https://www.jb51.net/">首页</a></li>
<li><a href="https://www.jb51.net/plus/list.php?tid=1">关于我们</a>
<div>
<a href="#">HTML DropDown</a>
<a href="#">DHTML DropDown menu</a>
<a href="#">JavaScript DropDown</a>
<a href="#">DropDown Menu</a>
<a href="#">CSS DropDown</a>
</div>
</li>
<li><a href="https://www.jb51.net/plus/list.php?tid=2">新闻中心</a>
<div>
<a href="#">ASP Dropdown</a>
<a href="#">Pulldown menu</a>
<a href="#">AJAX dropdown</a>
<a href="#">DIV dropdown</a>
</div>
</li>
<li><a href="https://www.jb51.net/plus/list.php?tid=3">解决方案</a>
<div>
<a href="#">ASP Dropdown</a>
<a href="#">Pulldown menu</a>
<a href="#">AJAX dropdown</a>
<a href="#">DIV dropdown</a>
</div>
</li>
<li><a href="https://www.jb51.net/plus/list.php?tid=4">产品展示</a>
<div>
<a href="#">ASP Dropdown</a>
<a href="#">Pulldown menu</a>
<a href="#">AJAX dropdown</a>
<a href="#">DIV dropdown</a>
</div>
</li>
<li><a href="https://www.jb51.net/plus/list.php?tid=5">支持与下载</a>
<div>
<a href="#">ASP Dropdown</a>
<a href="#">Pulldown menu</a>
<a href="#">AJAX dropdown</a>
<a href="#">DIV dropdown</a>
</div>
</li>
<li><a href="https://www.jb51.net/plus/list.php?tid=6">人才招聘</a>
<div>
<a href="#">ASP Dropdown</a>
<a href="#">Pulldown menu</a>
<a href="#">AJAX dropdown</a>
<a href="#">DIV dropdown</a>
</div>
</li>
<li><a href="https://www.jb51.net/plus/list.php?tid=7">联系我们</a>
<div>
<a href="#">ASP Dropdown</a>
<a href="#">Pulldown menu</a>
<a href="#">AJAX dropdown</a>
<a href="#">DIV dropdown</a>
</div>
</li>
</ul>
</dl>
</div>
</div>
</div>
您可能感兴趣的文章: