Hi,

just put your code inside a function and invoke this via the setTimeout loop.

or

there is a mechanism in Tobago to load script files which is used on
partial rendering via ajax. You can use it like this:

<t:script>
 new Tobago.ScriptLoader(["path/to/your/file.js"], "functionToCall()");
</t:script>

This will load your script after the onLoad handler of the body tag is finished.
The first argument is a array of script urls
The second is a string which is evaluated via the javascript eval() function.
Both could be empty.

Regards
   Volekr

2006/9/18, John <[EMAIL PROTECTED]>:
Volker,

Thank you so much.

So if I wanted to include the script from a file (it's pretty big);
currently the problematic version is done with <t:script file=

Any suggestions?

John

-----Original Message-----
From: Volker Weber [mailto:[EMAIL PROTECTED]
Sent: Monday, September 18, 2006 2:01 PM
To: MyFaces Discussion
Subject: Re: [myFaces-Tobago] - how to execute JavaScript file ONLY
after DOM is fully rendered.

Hi John,

you can do a loop with setTimeout() waiting for Tobago.pageIsComplete
becomes true. And you can use <t:script> to insert your script into
page.

like this:

<t:script>
  function doAferLoading() {
    if (!Tobago.pageIsComplete) {
      setTimeout("doAfterLoading()", 50);
    } else {
       // your script code
    }
  }

  doAfterLoading();
</t:script>

the value of Tobago.pageIsComplete is set to true by the tobago init
script after the initializing of the page is completed.

regards,
    Volker

2006/9/18, John <[EMAIL PROTECTED]>:
>
>
> This has caused a never ending headache for us (particularly with IE),

> when JavaScript starts to manipulate the DOM and objects aren't
complete yet.
> Can't use <t:script> obviously.
>
>
> What is the best practice?
>
> Example?
>
> Thanks,
> John


Reply via email to