简体   繁体   中英

Some Javascript errors on IE8 compatibility mode on IE11 windows 8

I'm trying to migrate a webapp that actually works on Windows XP/IE8 to work under Windows 8/IE11. When I try to test on this system under IE8 compatibility mode I receive the errors below:

SCRIPT5: The system cannot locate the resource specified. File:webservice.js, 
Line: 498, Column: 4 HTML1300: Navigation occurred.
File: DesktopWindow.aspx 
SCRIPT450: Wrong number of arguments or invalid property assignment File: operation.js, 
Line: 1849, Column: 3 SCRIPT5007: Unable to get property 'childNodes'
of undefined or null reference File: DesktopWindow.aspx,
Line: 100, Column: 5 SCRIPT450: Wrong number of arguments or invalid
property assignment File: DesktopWindow.aspx, Line: 1881, Column: 4

I have no problem on W XP and IE8. This app must work on both OS.

operation.js failed code:

for(j = 0; j < iNumData; j++)
{
    id = sIDs.getItem(j);
    value = top.AQContextArea(id);

    //Inform the AQDataArray with the values of the scripting dictionary, creating two copies
    //one for context area "G" an other for context area "F"

    res = objCA.InsertAQData1(operationID, id, value);

}   

DesktopWindow.aspx failed code:

function CargarListaPaginasNombresEstaticos()
        {   
            var serverName = top.GetAQData("G","SERVER_NAME");
            var xmlFolder = "AMTAConfig";
            var sXMLFileName = "http://" + serverName + "/" + xmlFolder + "/NombresEstaticosPaginas.xml";

            //var xmlDoc;
            var root;
            var nodos;
            var nodo;
            var nodos2;
            var nodo2;
            var nombre;
            var valor;

            xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
            xmlDoc.async = false;
            xmlDoc.onreadystatechange=verifyState;
            xmlDoc.load(sXMLFileName);

            root = xmlDoc.documentElement;
            nodos = root.childNodes;

            for (var i = 0; i < nodos.length; i++)
            {
                nodo = nodos.item(i);
                nodos2 = nodo.childNodes;

                for (var j = 0; j < nodos2.length; j++)
                {
                    nodo2 = nodos2.item(j);
                    if (nodo2.nodeName=="NombrePagina"){
                        nombre = nodo2.text;
                    }
                    if (nodo2.nodeName=="TituloPagina"){
                        valor = nodo2.text;
                    }                   
                }
                top.PaginasEstaticas.Add(nombre, valor);
            }
            return 0;
        }

I solve that problem changing the way to access to a Scripting.Dictionary. I use a two VBArray objects constructed using IDictionary keys and IDictionary Items to get the value. IE is no longer compatible with the old way to access to the value using the key

This is the failing code:

function LoadAQData()
{
var sIDs;
var iNumData;
var id;
var value;
var contextarea;
var operationID = "DWI";
var res="";
//throw(0);
//Dump AQ data defined in the scripting dictionary in the desktop window in an array
sIDs = (new VBArray(top.AQContextArea.Keys()));     
iNumData = top.AQContextArea.Count;

for(j = 0; j < iNumData; j++)
{
    id = sIDs.getItem(j);
    value = top.AQContextArea(id);

    //Inform the AQDataArray with the values of the scripting dictionary, creating two copies
    //one for context area "G" an other for context area "F"

    res = objCA.InsertAQData1(operationID, id, value);

}   

}

This is the solution:

function LoadAQData()
{
var sIDs;
var iNumData;
var id;
var value;
var contextarea;
var operationID = "DWI";
var res="";
//throw(0);
//Dump AQ data defined in the scripting dictionary in the desktop window in an array
sIDs = (new VBArray(top.AQContextArea.Keys()));
ItemsArray = (new VBArray(top.AQContextArea.Items()));  
iNumData = top.AQContextArea.Count;

for(j = 0; j < iNumData; j++)
{
    id = sIDs.getItem(j);
    value = ItemsArray.getItem(j);
    //Inform the AQDataArray with the values of the scripting dictionary, creating two copies
    //one for context area "G" an other for context area "F"

    res = objCA.InsertAQData1(operationID, id, value);

}   

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM