1

当我运行 Firefox 错误控制台时,我在下拉菜单中收到此错误:ddmenuitem 为空。除此之外,该页面似乎运行良好。

我收到的错误在它说的那一行: 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; 
4

1 回答 1

1

没有元素id=m2<a href="photo_gallery_pg1.html" onmouseout="mclosetime()" onmouseover="mopen('m2')">

于 2012-05-19T04:00:39.030 回答