我有以下代碼。面向對象的Javascript代碼不能在IE7中工作
function radioButtons() {
var _inputCount;
var _inputParentCount;
var _radioInput;
return {
inputCounter:function(groupId){
_inputCount = $(groupId).find("input");
_inputParentCount = $(_inputCount).parent();
for(i = 0; i < _inputParentCount.length; i++){
$(_inputParentCount[i]).attr("id", groupId + [i]);
}
},
radioAction:function(radioButton){
_radioInput = $(radioButton).find("input");
for(i = 0; i < _inputCount.length; i ++){
$(_inputCount[i]).parent().removeClass("selected");
$(_inputCount[i]).attr("value", "false");
}
$(radioButton).addClass("selected");
$(_radioInput).attr("value", "true");
},
};
};
var radioButtonsOne = new radioButtons();
$(document).ready(function(){
radioButtonsOne.inputCounter("#radioButtonsGroup");
});
它是我爲自定義單選按鈕編寫的自定義函數。我有一個類似的複選框按鈕。除了IE7之外,它在所有瀏覽器中都能正常工作。它告訴我radioButtonsOne
沒有被定義。但它是。任何想法爲什麼?
謝謝!
見http://stackoverflow.com/questions/5139205/javascript-can-a-comma-occur-after-the-last-一組數值集 – simon