The Mission:

- Loop through 10,000 input boxes and disable each one.
- Accomplish this quickly and without freezing the browser.
- It only *has* to work in IE6, but IE7 and FF would be nice.


I can't seem to accomplish this with any kind of speed in IE. In Firefox, it happens quite quickly and works wonderfully. In IE, with only 100 input fields, it freezes the browser temporarily (maybe 10 seconds) while looping through.

Based on some JS optimization tips I was reading, I've unrolled the loop and come up with the following.

Code:
var temp;
var x = 0;

i = parseInt( inputFields.length / 8 );

do
{
	inputFields[ x ].disabled = true;
	x++;
	inputFields[ x ].disabled = true;
	x++;
	inputFields[ x ].disabled = true;
	x++;
	inputFields[ x ].disabled = true;
	x++;
	inputFields[ x ].disabled = true;
	x++;
	inputFields[ x ].disabled = true;
	x++;
	inputFields[ x ].disabled = true;
	x++;
	inputFields[ x ].disabled = true;
	x++;
}
while( --i );

i = inputFields.length % 8;

if( i > 0 )
{
	do
	{
		inputFields[ x ].disabled = true;
		x++;
		
	}
	while( --i );
}
inputFields is the result of a call to table.getElementsByTagName( "INPUT" ) where table is the table generated as the output of my DataGrid.

Any insight would be much appreciated.