0

所以我买了一个网站,女巫连接到办公室的妊娠程序..

该网站有点旧,它与所有版本的 Internet Explorer 完全兼容,但与其他浏览器不兼容(opera、safari、chrome、firefox ...)

唯一不起作用的是菜单没有正确打开,当您单击它时它不会发生任何事情,或者在 chrome 中它会更改图像但它不会上传链接。似乎它没有在 hiddenframe 中上传东西......在 chrome 中它在 loadchildren 函数中给出了错误。

在 Firefox 中,它在函数 Toc_click () 中给出错误

TypeError: window.event is undefined
[Break On This Error]   

var eSrc = window.event.srcElement;

我们搜索了问题,我们认为问题应该出在这个文件中,问题应该是语法问题,它在旧浏览器中兼容,但在新浏览器上不兼容。我无法完全更改代码,因为它与其他文件(很多)和 sql server 连接...

我们已经尝试改变

      document.frames["hiddenframe"].location.replace(strLoc);

经过

      document.getElementsByName("hiddenframe").location.replace(strLoc);

它不起作用,它也不能在 IE 上运行......

 /* TOC.JS */

var framesTop = parent.parent;

//var L_LoadingMsg_HTMLText = "Loading, click to cancel...";
var LoadDiv = '<DIV ONCLICK="loadFrame(true);" CLASS="clsLoadMsg">';
L_LoadingMsg_HTMLText = LoadDiv + L_LoadingMsg_HTMLText + "</LI>";

function caps(){
    var UA = navigator.userAgent;
    if(UA.indexOf("MSIE") != -1)
    {
        this.ie = true;
        this.v = UA.charAt(UA.indexOf("MSIE") + 5);
        if( this.v == 2 ) this.ie2 = true;
        else if( this.v == 3 ) this.ie3 = true;
        else if( this.v == 4 ) this.ie4 = true;
        else if( this.v == 5 ) this.ie5 = true;
        else if( this.v == 6 ) this.ie6 = true;
    else this.ie6 = true;
    }
    else if(UA.indexOf("Mozilla") != -1 && UA.indexOf("compatible") == -1)
    {
        this.nav = true;
        var v = UA.charAt(UA.indexOf("Mozilla") + 8);
        if(v == 2 ) this.nav2 = true;
        else if(v == 3 ) this.nav3 = true;
        else if(v == 4 ) this.nav4 = true;
    }
    if(UA.indexOf("Windows 95") != -1 || UA.indexOf("Win95") != -1 || UA.indexOf("Win98") != -1 || UA.indexOf("Windows 98") != -1 || UA.indexOf("Windows NT") != -1 || UA.indexOf("Windows XP") != -1) this.win32 = true;
    else if(UA.indexOf("Windows 3.1") != -1 || UA.indexOf("Win16") != -1) this.win16 = true;
    else if(UA.indexOf("Mac") != -1) this.anymac = true;
    else if(UA.indexOf("SunOS") != -1 || UA.indexOf("HP-UX") != -1 || UA.indexOf("X11") != -1) this.unix = true;
    else if(UA.indexOf("Windows CE") != -1) this.wince = true;
}

var bc = new caps();

////////////////////////////////////////////
// Not sure why this is here, it puts a scrollbar up when none is needed
// if("object" == typeof(parent.document.all.fraPaneToc)) parent.document.all.fraPaneToc.scrolling = "yes";
////////////////////////////////////////////

var eSynchedNode = null;
var eCurrentUL = null;
var eCurrentLI = null;
var bLoading = false;

function loadFrame( bStopLoad )
{
    if( "object" == typeof( eCurrentUL ) && eCurrentUL && !bStopLoad )
    {
      eCurrentUL.innerHTML = hiddenframe.chunk.innerHTML;
      eCurrentUL = null;
      bLoading = false;
    }
    else if( "object" == typeof( eCurrentUL ) && eCurrentUL )
    {
      eCurrentUL.parentElement.children[1].className = "";
      eCurrentUL.parentElement.children[0].src = "bs.gif";
      eCurrentUL.parentElement.className = "kid";
      eCurrentUL.className = "clsHidden";
      eCurrentUL.innerHTML="";
      eCurrentUL = null;
      bLoading = false;
    }
    else
    {
      bLoading = false;
    }
    return;
}

function GetNextUL(eSrc)
{
    var eRef = eSrc;
    for(var i = eRef.sourceIndex + 1; i < document.all.length; i++)
    {
        if( "UL" == document.all[ i ].tagName )
        {
            return document.all[ i ];
        }
        else if( "LI" == document.all[ i ].tagName )
        {
            break;
        }
    }
    return false;
}

function MarkSync(eSrc)
{
    if("object" == typeof(aNodeTree)) aNodeTree = null;
    if("LI" == eSrc.tagName.toUpperCase() && eSrc.children[1] && eSynchedNode != eSrc )
    {
        UnmarkSync();
        eSrc.children[1].style.fontWeight = "bold";
        eSynchedNode = eSrc;
    }
}

function UnmarkSync()
{
    if("object" == typeof(eSynchedNode) && eSynchedNode )
    {
        eSynchedNode.children[1].style.fontWeight = "normal";
        eSynchedNode = null;
    }
}

function MarkActive(eLI)
{
    if( "object" == typeof( eLI ) && eLI && "LI" == eLI.tagName.toUpperCase() && eLI.children[1] && eLI != eCurrentLI )
    {
        MarkInActive();
        window.eCurrentLI = eLI;
        window.eCurrentLI.children[1].className = "clsCurrentLI";
    }
}

function MarkInActive()
{
    if( "object" == typeof( eCurrentLI ) && eCurrentLI )
    {
        window.eCurrentLI.children[1].className = "";
        window.eCurrentLI = null;
    }
}

function LoadChildren( eLink )
{
    var strLoc = "loadtree.asp" + eLink.href.substring( eLink.href.indexOf( "?" ) );
    document.frames["hiddenframe"].location.replace(strLoc);
}

function Navigate_URL( eSrc )
{
    var eLink = eSrc.parentElement.children[1];
    urlIdx = eLink.href.indexOf( "URL=" );
    if("object" == typeof(framesTop.fraTopic) && eLink && "A" == eLink.tagName && urlIdx != -1 )
    {
        if(eLink.target=="fraTopic"||eLink.target=="_top"){
            framesTop.fraTopic.location.href = eSrc.parentElement.children[1].href.substring( urlIdx + 4 );
        }else{
            window.open(eSrc.parentElement.children[1].href,eLink.target);
        }
        MarkSync(eSrc.parentElement);
    }
    else if("object" == typeof(framesTop.fraTopic) && eLink && "A" == eLink.tagName  && eLink.href.indexOf( "tocPath=" ) == -1 && eLink.href.indexOf( "javascript:" ) == -1 )
    {
        if(eLink.target=="fraTopic")
        {
            framesTop.fraTopic.location.href = eSrc.parentElement.children[1].href;
        }
        else if( eLink.target=="_top" )
        {
            top.location = eLink.href;
            return;
        }
        else
        {
            window.open(eSrc.parentElement.children[1].href,eLink.target);
        }
        MarkSync(eSrc.parentElement);
    }
    else if( eSynchedNode != eSrc.parentElement && ( urlIdx != -1 || ( eLink.href.indexOf( "javascript:" ) == -1 && eLink.href.indexOf( "tocPath=" ) == -1 ) ) )
    {
        // START D.S.
        if(eLink.target=="fraTopic")
        {
            if (navigator.userAgent.indexOf("Windows") == -1) {
                var MyHref = eSrc.parentElement.children[1].href;
                do
                {
                    if (MyHref.indexOf("%2E") != -1) MyHref = MyHref.replace("%2E", ".");
                    else if (MyHref.indexOf("%2F") != -1) MyHref = MyHref.replace("%2F", "/");
                    else if (MyHref.indexOf("%3F") != -1) MyHref = MyHref.replace("%3F", "?");
                    else if (MyHref.indexOf("%3D") != -1) MyHref = MyHref.replace("%3D", "=");
                    else if (MyHref.indexOf("%26") != -1) MyHref = MyHref.replace("%26", "&");
                    else break;
                } 
                while (true);
                parent.fraTopic.location.href = MyHref;
            } else {
                parent.fraTopic.location.href = eSrc.parentElement.children[1].href;
            }
        }
        // END D.S.
        MarkSync( eSrc.parentElement );
    }
}

function Image_Click( eSrc , bLeaveOpen )
{
    var eLink = eSrc.parentElement.children[1];
    if("noHand" != eSrc.className)
    {
        eLI = eSrc.parentElement;
        MarkActive(eLI);
        var eUL = GetNextUL(eLI);
        if(eUL && "kidShown" == eLI.className)
        {
            // hide on-page kids
            if( !bLeaveOpen )
            {
                eLI.className = "kid";
                eUL.className = "clsHidden";
                eSrc.src = "bs.gif";
            }
        }
        else if(eUL && eUL.all.length)
        {
            // show on-page kids
            eLI.className = "kidShown";
            eUL.className = "clsShown";
            eSrc.src = "bo.gif";
        }
        else if("kid" == eLI.className)
        {
            // load off-page kids
            if( !bLoading )
            {
                bLoading = true;
                eLI.className = "kidShown";
                eUL.className = "clsShown";
                window.eCurrentUL = eUL;
                eSrc.src = "bo.gif";
                eUL.innerHTML = L_LoadingMsg_HTMLText;
                LoadChildren( eLink );
            }
        }
    }
}

function Toc_click ()
{
    var eSrc = window.event.srcElement;
    event.returnValue = false;

    if("A" == eSrc.tagName.toUpperCase() && "LI" == eSrc.parentElement.tagName)
    {
        var eImg = eSrc.parentElement.children[0];
        if(eImg) eImg_click(eImg);
    }
    else if("SPAN" == eSrc.tagName && "LI" == eSrc.parentElement.tagName)
    {
        var eImg = eSrc.parentElement.children[0];
        if(eImg) eImg_click(eImg);
    }
    else if("IMG" == eSrc.tagName)
    {
    }
    return event.returnValue;
}

function eImg_click(eImg)
{
    if("IMG" == eImg.tagName)
        {
            Image_Click( eImg , false );
            Navigate_URL( eImg );
        }
}

function Toc_dblclick()
{
    return;
}

function window_load()
{
    if( self == top ) location.replace( "default.asp" );
    var objStyle = null;
    if( bc.win32 && ( bc.ie4 || bc.ie5 || bc.ie6 ) && "object" == typeof ( ulRoot ) && "object" == typeof( objStyle = document.styleSheets[0] ) && "object" == typeof( objStyle.addRule ) )
    {
        window.eSynchedNode = document.all["eSynchedNode"];
        objStyle.addRule( "UL.clsHidden" , "display:none" , 0 );
        objStyle.addRule( "UL.hdn" , "display:none" , 0 );
        //--ulRoot.onclick=Toc_click;
        ulRoot.ondblclick=Toc_dblclick;
        if( window.eSynchedNode )
        {
            MarkActive(window.eSynchedNode);
            window.eSynchedNode.all.tags( "B" )[0].outerHTML = eSynchedNode.all.tags("B")[0].innerHTML;
            window.scrollTo(0,window.eSynchedNode.offsetTop-(document.body.clientHeight/2));
        }
        else
        {
            MarkActive(document.all.tags( "LI" )[0]);
        }
    }
}

window.onload = window_load;

建议?

4

0 回答 0