繁体   English   中英

IE11 Windows 8上IE8兼容模式下的一些Javascript错误

[英]Some Javascript errors on IE8 compatibility mode on IE11 windows 8

我正在尝试将实际可在Windows XP / IE8上运行的web应用程序迁移到Windows 8 / IE11下。 当我尝试在IE8兼容模式下在此系统上进行测试时,收到以下错误:

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

我在W XP和IE8上没有问题。 此应用程序必须在两个OS上均可使用。

operation.js失败的代码:

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失败的代码:

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;
        }

我解决了这个问题,改变了访问Scripting.Dictionary的方式。 我使用两个使用IDictionary键和IDictionary项目构造的VBArray对象来获取值。 IE与使用密钥访问值的旧方法不再兼容

这是失败的代码:

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);

}   

}

这是解决方案:

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);

}   

}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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