All i'm doing is , i have a table wicth can have multiple rows or none, or
even 1 depending on the search. I have this table in a jsp page. I then
have another jsp where I link to my table via an iframe.
Now for each row listed in the iframe i also build a checkbox. I use the
foloowing to check and Uncheck all checkboxes in the frame.
function verifyManualCheckUncheck()
{
if (document.frames[0].document.all.resendtriggerlist == null)
{
return;
}
if (checkFlag == false)
{
if (document.frames[0].document.all.resendtriggerlist.length > 0)
{
for (i = 0; i <
document.frames[0].document.all.resendtriggerlist.length; i++)
{
if (
document.frames[0].document.all.resendtriggerlist[i].checked == true )
{
resendData +=
document.frames[0].document.all.resendtriggerlist[i].value + ",";
deleteData +=
document.frames[0].document.all.resendtriggerlist[i].value + ",";
}
} //end for loop
}
}
}
now if one row is returned then this function fails. if i put an alert() to
get the length of the iframe then it ldisplays undefined
hope this is useful
"RobB" <fe******@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Lans Redmond wrote: I have an iframe within a jsp page which displays rows from a
database. I then have a checkbox where, when I check/uncheck the checkbox it
performs operations on the rows listed in the frame.
I get a jscript "undefined" error if 1 row is returned in the
iframe. If I have more that 1 then my length for the iframe shows the amount. if
only 1 row is the iframe then my length comes up undefined
Very difficult to recommend anything without knowing what you're doing.
Presumably a reference to 'the rows listed in the frame' is held in an
array, and no array is generated if there's only one row, so you can't
loop through it using the .length property. The fix is usually
something like:
obj = ('undefined' != typeof obj[0]) ? obj : [obj];
...where 'obj' is the (possible) array you're examining. Can't say more
without seeing more.