CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 JavaScript SlowDown

Print topic Send  topic

Author Message
Intexk
Posted: 12/15/2005, 4:07 AM

This wonderfull function (forms_onload) found in functions.js is making all pages displays very slow (usually when u have lots of elements in a page)
For example i have one page with an editable grid (1200 rows)..and it takes more than 45 seconds to render the page(not to load the html).

The Problem is this

for(i = 0; i < forms.length; i++)

for (j = 0; j < form.elements.length; j++)

if u do that in new internet explorers (mozilla too),for each iteration in the loop it will recount all elements...and that is a lot of time wasted.

I Suggest u change that function to something like this:

function forms_onload()
{
var forms = document.forms;
var i, j, elm, form;
var ic=forms.length;
for(i = 0; i < ic; i++)
{
form = forms;
if (typeof(form.onLoad) == "function") form.onLoad();
var jc=form.elements.length;
for (j = 0; j < jc; j++)
{
elm = form.elements[j];
if (typeof(elm.onLoad) == "function") elm.onLoad();
}
}
return true;
}
E43509

Posts: 283
Posted: 12/15/2005, 5:56 AM

Curious, what version? 2 or 3 ccs?
View profile  Send private message
Intexk
Posted: 12/16/2005, 2:13 AM

both versions, that forms_onload hasn't changed anything since long time ago.
Intexk
Posted: 12/16/2005, 5:32 AM

this is light speed version of forms_onload

function forms_onload()
{
for(var form in document.forms)
{
if (typeof(form.onLoad) == "function") form.onLoad();
for(var elm in form.elements)
{
if (typeof(elm.onLoad) == "function") elm.onLoad();
}
}
return true;
}
Intexk
Posted: 12/19/2005, 4:16 AM

above functions doesn't work very well...(or nothing..lol) :(

but this one rocks.

function forms_onload()
{
for(var i = 0,form ;form =forms; i++)
{
if (typeof(form.onLoad) == "function") form.onLoad();
for (var j = 0,elm;elm=form.elements[j]; j++)
{
if (typeof(elm.onLoad) == "function") elm.onLoad();
}
}
return true;
}
Intexk
Posted: 12/19/2005, 4:38 AM

function forms_onload()
{
var forms=document.forms;
for(var i = 0,form ;form =forms [ i ] ; i++)
{
if (typeof(form.onLoad) == "function") form.onLoad();
for (var j = 0,elm;elm=form.elements [ j ] ; j++)
{
if (typeof(elm.onLoad) == "function") elm.onLoad();
}
}
return true;
}

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.