2012-06-27 28 views
0

我有一段代碼在FireFox,Chrome和InternetExplorer 9中正常工作,但不在InternetExplorer 8中工作。我正在處理選擇框。使用IE8添加方法的JavaScript錯誤

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方法錯誤,是說無效的參數...

有誰知道什麼可以在IE8的錯誤?

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

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

謝謝!

+0

這是YUI代碼嗎? – epascarello

回答

0

countryList.add()?我會用countryList.appendChild()

+0

工作過,非常感謝你! – user1261175

+0

不客氣 - 在StackOverflow中,您可以通過upvoting來表示您的讚賞。選擇我的答案,並給我upvote! –