Forum Moderators: open
I have a for loop that runs perfectly well under IE6 but does nothing under Netscape 7.1 and I was wondering if there's a work around.
I have a list called region on a form and I'm passing the form as the parameter "thisform".
During debug I've found that the script just stops at thisform.region(idx).selected - no error - just stops.
Here's the piece of code that's failing:
===========================
for (idx = 0; idx < thisform.region.length ; idx++)
{if (thisform.region(idx).selected == true)
{regions ++
};
} any ideas
Thanks
var idx, region = thisform.regions
for (idx = 0; idx < region.length ; idx++)
if (region[idx].selected)
regions ++/* maybe more 'correct':
region.options[idx]
// or
region.options.item(idx) //!*/
..but seriously now, IE has inbuilt backward-compatibility with old methods, and features a number of convenience properties etc. Its standards support could be described as "not what it could be", but it's not that bad. In our case, IE wasn't guilty of anything other than offering an alternative.
The problem comes when people (me included) learn the IE-only techniques first, without realising (or being informed) that they are proprietary.