使用IE8添加方法时出现JavaScript错误 [英] JavaScript Error in add method using IE8
本文介绍了使用IE8添加方法时出现JavaScript错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在这里有一段代码在FireFox,Chrome和InternetExplorer 9中正常工作但在InternetExplorer 8中无效。我正在处理选择框。
I have a piece of code here which is working fine in FireFox, Chrome and InternetExplorer 9 but is not working in the InternetExplorer 8. I'm dealing with select boxes.
var finalExclusionList = Dom.get("finalExclusionList-box");
var countryList = Dom.get("regionsAndCountries-box");
for (var i=0; i<finalExclusionList.length; i++) {
countryList.add(finalExclusionList[i]);
}
我在countryList.add方法中遇到错误,说无效参数...
I'm having error in the countryList.add method, is saying Invalid Argument ...
有谁知道IE8中的错误是什么?
Does anyone knows what can be the error in IE8 ?
IE8 - CONSOLE.LOG
IE8 - CONSOLE.LOG
console.log(countryList)
LOG: [object HTMLSelectElement]
console.log(countryList[0])
LOG: [object HTMLOptionElement]
console.log(finalExclusionList[i])
LOG: [object HTMLOptionElement]
console.log(countryList.add)
LOG:
function add() {
[native code]
}
IE9 - CONSOLE.LOG
IE9 - CONSOLE.LOG
>> console.log(countryList)
LOG: [object HTMLSelectElement]
>> console.log(countryList[0])
LOG: [object HTMLOptionElement]
>> console.log(finalExclusionList[i])
LOG: [object HTMLOptionElement]
>> console.log(countryList.add)
LOG:
function add() {
[native code]
}
谢谢!
推荐答案
countryList 。新增()
?我会使用 countryList.appendChild()
。
这篇关于使用IE8添加方法时出现JavaScript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文