最近做了一个导航条,能下拉显示二级菜单,但鼠标移到二级菜单,一级菜单的当前高亮效果就消失了,我是用hover控制的,一旦失去焦点,hover的背景控制就没了,如何才能使他移到二级菜单的时候 高亮的效果还在,移出就没了。谢谢~
附件在下面~谢谢大家 :idea:
[code="HTML部分"]
<!-- 产品 cb函数为changebackground -->
主营产品
支持与服务
- 地址: 上海市xx区xxxx路xxxx弄xxxx号楼
- 总机: 021-xxxxxxxx~xxx
</div>
[/code]
[code="JS部分"]
var st;
//rising index table 标签切换--加入延时
function etabit(basename,totalnum,nownum){
clearTimeout(st);
st=setTimeout("etabit2('"+basename+"','"+totalnum+"','"+nownum+"')",400);
return false;
}
function etabit2(basename,totalnum,nownum){
clearTimeout(st);
var btnname = basename+'_btn';
var divname = basename+'_div';
for(var i=0;i<totalnum;i++){
document.getElementById(btnname+'_'+i).className = "";
document.getElementById(divname+'_'+i).style.display = "none";
}
document.getElementById(btnname+'_'+nownum).className = "selected";
document.getElementById(divname+'_'+nownum).style.display = "";
return false;
}
//rising indexhead 首页头部浮层--加入延时
function indexheadchange(num){
clearTimeout(st);
st=setTimeout("indexheadchange2('"+num+"')",400);
}
function indexheadchange2(num){
clearTimeout(st);
for(var i=0;i<8;i++)
{
if(document.getElementById('indexhead_div_'+i))
{
document.getElementById('indexhead_div_'+i).style.display = "none";
}
}
if(document.getElementById('indexhead_div_'+num))
{
document.getElementById('indexhead_div_'+num).style.display = "";
}
}
function closeindexhead()
{
clearTimeout(st);
for(var i=0;i<8;i++)
{
if(document.getElementById('indexhead_div_'+i))
{
document.getElementById('indexhead_div_'+i).style.display = "none";
}
}
}
function cb(imageurl,divid)
{
if(imageurl!='null'){
document.getElementById(divid).style.backgroundImage="url("+imageurl+")";
}
}
//rising current
[/code]