'长度'是null还是不是对象?即8.请帮忙

'length' is null or not an object? IE 8. Help please

本文关键字:是不是 长度 null 对象      更新时间:2023-09-26

这是代码,有什么想法吗?这在其他浏览器中也适用,但在ie8中却被卡住了。任何帮助都将不胜感激。

function getRadioValue(radioN)
{
    for(i=0; i<document.kartice_form[radioN].length; i++)
    {
        if (document.kartice_form[radioN][i].checked == true)
            return parseInt(document.kartice_form[radioN][i].value);
    }
}

使用jQuery为您重新编写的函数(假设jQuery是可以的,因为您将其包含在标签中):

function getRadioValue(radioN) {
    return parseInt($('input[name="+radioN+"]:checked').val());
}