tags:

views:

26

answers:

1

Hi all,

I have a problem with JavaScript code, it works in IE7/8, but doesn't work in Firefox

for (var i = 1; i < document.getElementById(obj).rows.length; i++)
{
    var numColumns = document.getElementById(obj).rows(i).cells.length;
    if (numColumns > 0)
    {
        if (document.getElementById(obj).rows(i).cells(numColumns - 1).children.length > 1)
        {
            if (document.getElementById(obj).rows(i).cells(numColumns - 1).children(1).checked == true)
            {
                var ctrlId = document.getElementById(obj).rows(i).cells(numColumns - 1).children(1).id.replace('chk', 'txt')
                workflowIds = workflowIds + (workflowIds == '' ? '' : '|') + document.getElementById(ctrlId).value;
            }
        }
    }
}

The error: "Error: document.getElementById(obj).rows is not a function ... etc"

Thanks !!!

+3  A: 

Use [], not (), for rows and cells (they're arrays !)

document.getElementById(obj).rows[i].cells[numColumns - 1] //...

Edit : the same for children. And prefer childNodes, I don't know if children is understood by FF.

Pikrass
Thanks, It really helped me !!!
Alexander Corotchi