The problem: I need to dynamically assign some params for elements (input fields) on a page when it loads. But I can't do it before the elements are actually there (page has been loaded).
I can't use window.onLoad or <body onLoad="func();"> because I have no access to the <head> part of pages (framework issue). So my altering functions are included in the body part of page.
I tried to use this function:
Sadly it doesn't avoid the "racing condition" and thus doesn't work for bigger (larger) pages
I can get the same function to work if I add an additional timeout like that:
But thats not a good solution and may fail with even bigger pages...
I think that my approach to keep checking until something is done, is not bad, but maybe I could/should check something else instead of
Any ideas?
I can't use window.onLoad or <body onLoad="func();"> because I have no access to the <head> part of pages (framework issue). So my altering functions are included in the body part of page.
I tried to use this function:
Code:
function checkLoading(){
if (document.body)
eval("myFunction()\;");
else
setTimeout("checkLoading()", 1);
}

Code:
function checkLoading(){
if (document.body)
[b]setTimeout("myFunction()", 100);[/b]
else
setTimeout("checkLoading()", 1);
}
I think that my approach to keep checking until something is done, is not bad, but maybe I could/should check something else instead of
Code:
if (document.body)
Any ideas?