troubleshooting Question

Slow javascript loop..

Avatar of plq
plqFlag for United Kingdom of Great Britain and Northern Ireland asked on
JavaScript
9 Comments1 Solution841 ViewsLast Modified:
Any ideas how to speed this up ?

I've tried the easier option of running thru maintable.all but thats even worse. Its a long table in a scrollable div

1. Is there a way of doing a bulk change to many elements at once
2. Is there some kind of doevents function in js that will allow the user to continue working as it runs ?
3. Any other thoughts on speeding it up ?

function doedit()
{
      var ctl;

      var ctltypes = new Array("SELECT", "INPUT", "TEXTAREA");

      // perf improv over scanning all tags
      for (var c = 0; c < ctltypes.length; c++)
      {
            for (var k = 0; k < maintable.all.tags(ctltypes[c]).length; k++)
            {
                  ctl = maintable.all.tags(ctltypes[c])[k];
                  if (ctl.disabled)
                  {
                        ctl.disabled = false;
                  }
            }
      }
}


thanks
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros