当我运行Firefox错误控制台时,我在下拉菜单中收到此错误:ddmenuitem为null。除此之外,页面似乎运行良好。
我收到的错误就是说:ddmenuitem.style.visibility =' visible';
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;
答案 0 :(得分:1)
没有id=m2
的元素:<a href="photo_gallery_pg1.html" onmouseout="mclosetime()" onmouseover="mopen('m2')">