myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Volker Weber" <weber.vol...@googlemail.com>
Subject Re: [myFaces-Tobago] - how to execute JavaScript file ONLY after DOM is fully rendered.
Date Mon, 18 Sep 2006 21:00:49 GMT
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 <johnk@jak.com>:
>
>
> 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

Mime
View raw message