在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
我在XP和IE8上没有问题。此应用程序必须在两个操作系统上运行。
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的方式来解决这个问题。我使用两个使用字典键和字典项构造的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);
}
}
相关文章:
- object响应时出现对象错误javascript
- 未捕获的语法错误:javascript对象上出现意外的标记ILLEGAL
- Phonegap-Android 4.4-html5音频长度错误(javascript和媒体插件)
- 未捕获的语法错误:javascript中出现意外的标记}
- 如何从 MVC4 链接调用 Javascript 方法(错误 JavaScript 运行时错误:对象不支持此操作)
- 未捕获类型错误javascript方法
- 将字符串返回到类型为“0”的输出字段;数字“;针对用户错误javascript
- 解析器错误(Javascript初学者寻找解决方案)
- IE 错误 .JavaScript 运行时错误:对象不支持属性或方法“preventDefault”
- appendChild 不是函数错误 (JAVASCRIPT)
- 错误 JavaScript 函数
- 而循环抛出错误JavaScript
- 意外的类型错误 - Javascript,多维数组
- 语法错误:Javascript 中的意外令牌/将数据发布到 Amazon s3
- 语法错误:Javascript 中缺少指数
- 错误“JavaScript 运行时错误:查找滚动位置时无法获取未定义或空引用的属性'scrollLeft'”
- 错误 JavaScript 循环数组
- 错误:Javascript 上的 [对象对象]
- IndexedDBShim.js错误:JavaScript运行时错误:在严格模式下不允许分配只读属性
- 在Evernote listNotebooks API上获取错误-Javascript/Node.Js