我在导航中插入另一个新子菜单时遇到问题。
这是我的 JavaScript 代码:
// Main Nav Javascript Function *****************************************
var navTimer = "";
bop = new Object();
bop.targetDiv = "";
bop.hide = function(){
document.getElementById(bop.targetDiv).style.visibility = "hidden";
}
function openNav(myDiv){
if(bop.targetDiv != "") bop.hide();
bop.targetDiv = myDiv;
clearTimeout(navTimer);
document.getElementById(myDiv).style.visibility = "visible";
document.getElementById(myDiv).onmouseout = function(){
navTimer = setTimeout("bop.hide()", 100);
}
document.getElementById(myDiv).onmouseover = function(){
clearTimeout(navTimer);
}
}
function hideNav(myDiv){
bop.targetDiv = myDiv;
navTimer = setTimeout("bop.hide()", 150);
}
<!-- Display Sub Nav / Clear Sub Nav -->
function SubNav(myVar){
document.getElementById(myVar).style.visibility = "visible";
}
function clearNav(myVar){
document.getElementById(myVar).style.visibility = "hidden";
}
function shortPopUp( url, name, width, height, scrollbars ) {
var top = "0";
var left = "0";
if( scrollbars == null ) scrollbars = "0";
str = "";
str += "resizable=1,titlebar=1,menubar=1,";
str += "toolbar=0,location=0,directories=0,status=0,";
str += "scrollbars=1" + scrollbars + ",";
str += "width=" + width + ",";
str += "height=" + height + ",";
str += "top=" + top + ",";
str += "left=" + left;
window.open( url, name, str );
}
这是我的 HTML 代码:
><div class="navItem" onMouseOver="SubNav('seat-twenty');" onMouseOut="clearNav('seat-twenty');"><a href="fps_twenty2.html" target="frame">Twenty2</a><div id='seat-twenty' class="dropDown" onMouseOver="SubNav('seat-twenty');" onMouseOut="clearNav('seat-twenty');">
<div class="navItem"><a href="fps_twenty2.html" target="frame">Twenty2 Overview</a></div>
<div class="navItem"><a href="fb_twenty2_black.html" target="frame">Twenty2</a></div>
<div class="navItem"><a href="fb_twenty2_red.html" target="frame">Twenty2-US</a></div>
<div class="navItem"><a href="fb_twenty2_red_black.html" target="frame">Twenty2-UP</a></div>
</div></div>
服务器上的页面可以在这里找到。
问题出在导航的座位选项卡下,当我尝试插入新标签“Twenty2”时,没有打开额外的子菜单,子菜单仍然停留在同一个下拉菜单中....然后我检查了代码并结束了,我的错误代码和正确的代码没有区别。
这是运行良好的代码:
> <div class="navItem" onMouseOver="SubNav('seat-heavy');"
> onMouseOut="clearNav('seat-heavy');"><a href="fps_heavy_duty.html"
> target="frame">Heavy Duty</a><div id='seat-heavy' class="dropDown"
> onMouseOver="SubNav('seat-heavy');"
> onMouseOut="clearNav('seat-heavy');">
有人知道出了什么问题吗?