日期:2014-05-16  浏览次数:20442 次

在线求一个关于下拉菜单的处理
页面代码如下:

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html   xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<style   type= "text/css ">
<!--
*{margin:0;padding:0;border:0;}
body   {
font-family:   arial,   宋体,   serif;
                font-size:12px;     background:#eee;
}
#nav   {
  line-height:   24px;     list-style-type:   none;   background:#666;   width:100%
}
#nav   a   {
display:   block;   width:   90px;   text-align:center;background:#666;
}
#nav   a:link     {
color:#ffffff;   text-decoration:none;
}
#nav   a:visited     {
color:#ffffff;text-decoration:none;
}
#nav   a:hover     {
color:#FFF;text-decoration:none;font-weight:bold;
}
#nav   li   {
float:   left;   width:   auto;   background:#E9EBED;
}
#nav   li   a:hover{
background:#999;
}
#nav   li   ul   {
line-height:   27px;     list-style-type:   none;text-align:left;
left:   -999em;   width:   1280px;   position:   absolute;   float:left;color:#fff;   background:   #E9EBED;  
}
#nav   li   ul   li{
float:   left;   width:   auto;
background:   #E9EBED;
}
#nav   li   ul   a{
display:   block;   width:   auto;text-align:center;color:#fff;background:   #E9EBED;  
}
#nav   li   ul   a:link     {
color:#666;text-decoration:none;background:   #E9EBED;  
}
#nav   li   ul   a:visited     {
color:#666;text-decoration:none;background:   #E9EBED;  
}
#nav   li   ul   a:hover     {
color:#666;text-decoration:underline;font-weight:normal;background:   #E9EBED;  
}
#nav   li:hover   ul   {
left:   0;background:   #E9EBED;
}
#nav   li.sfhover   ul   {
left:   0;background:   #E9EBED;
}
#content   {
clear:   left;  
}
-->
</style>
<script   type=text/javascript>
function   menuFix()   {
var   sfEls   =   document.getElementById( "nav ").getElementsByTagName( "li ");

for   (var   i=0;   i <sfEls.length;   i++)   {
sfEls[i].onmouseover=function()   {
this.className+=(this.className.length> 0?   "   ":   " ")   +   "sfhover ";
}
sfEls[i].onMouseDown=function()   {
this.className+=(this.className.length> 0?   "   ":   " ")   +   "sfhover ";
}
sfEls[i].onMouseUp=function()   {
this.className+=(this.className.length> 0?   "   ":   " ")   +   "sfhover ";
}
sfEls[i].onmou