0
我使用這個JS腳本進行多國選擇,並從螢火蟲中得到一個錯誤。無效對象問題
selObj is null
[Break on this error] selObj.options[0] = new Option('Select Country','');
相關的代碼是這樣的:
function populateCountry(idName) {
var countryLineArray = country.split('|'); // Split into lines
var selObj = document.getElementById(idName);
selObj.options[0] = new Option('Select Country','');
selObj.selectedIndex = 0;
for (var loop = 0; loop < countryLineArray.length; loop++) {
lineArray = countryLineArray[loop].split(':');
countryCode = TrimString(lineArray[0]);
完整的腳本can be found here。
這是我如何使用它在我的HTML:
<select id="billCountrySelect" onchange="updateState('billCountrySelect')" name="bill_country">
有什麼問題。我通過它正確的參數??
由於您沒有報告錯誤,因此我們無法提供幫助。 – 2009-07-21 22:35:09