【发布时间】:2019-01-28 05:28:54
【问题描述】:
在我的 JavaScript 中,我有一个函数 detectEnvironmentAndGetLEAndDepot(),它通过 HTML 调用 onload。我正在使用 wicket,需要获取后端保存的值,所以我将它们发射到屏幕上,隐藏它们,然后从我的 JS 中搜索 <span> 值以获取 name 值,例如 @ 987654325@ 或 if(v.getAttribute('name') === 'depot'){do stuff} (我确定不是最优雅的解决方案,但我需要一个快速的解决方案!)。然后在函数detectEnvironmentAndGetLEAndDepot() 中进行一些格式化等操作,以便数据可用。
detectEnvironmentAndGetLEAndDepot() 函数(很长,只有相关部分)-
detectEnvironmentAndGetLEAndDepot = function() {
Array.from(document.getElementsByTagName('span')).forEach(function(v) {
//Search name tag for particular names, then do formatting
}
当我在 IE11 中打开它时,我在弹出窗口 SCRIPT438: Object doesn't support property or method 'from' 中收到错误,这与上述方法的第一行 - Array 类有关。非常感谢您的帮助。
【问题讨论】:
标签: javascript html angularjs internet-explorer-11