While layers are sequentially created, since all your JS is executed, the
rendering engine does not execute. Jacascript is not multithreaded as you would
think. Actions are enqueued and executed sequentially. That's why an infinite
loop will block all your events and functions from working, the JS engine is
occupied.

The alert you're placing interrups the javascript engine, allowing the
rendering engine to kick in and draw the 'please wait' while the JS is waiting
for you to accept.

Place your code in a setTimeout
setTimeout("makeLayers()",0)

this will queue this action after the current function call, allowing the
rendering to occur before the layers are created.


Regarding your other question, add a hidden input field in your form that
contains a string to be executed.

<form>
<input type=hidden name=onload
value="parent.mainframenamegoeshere.functiontobecalled()">
<textarea>
Network collapsing bunch of data
<textarea>
</form>

Then your CGI can collect that field name and use it to call the appropiate
function. This way you can reuse your CGI in different cases, simply chamging
the function to be called when the transmission is done



Hershel Robinson wrote:

> I have a page which generates a LOT of layers when it loads.  This
> generation can take over 10 seconds on my 450MHz WinNT machine.  I would
> like to be able to show a "Please wait" window so the user has something to
> look at while waiting.  I am having trouble doing this.
>
> I tried this:
>
> DynAPI.onLoad = function() {
>     waitlayer=new DynLayer(null,410,5,400)
>     waitlayer.setHTML("Please wait.")
>     DynAPI.document.addChild(waitlayer)
> //alert(1)
>     makeLayers()
> }
>
> function makeLayers() {
> // make a lot of layers here :)
> }
>
> This code does not work.  I don't see the waitlayer until makeLayers is
> finished 10 seconds later.  If I uncomment the alert(1), however, then I DO
> see the waitlayer and the alert box.  When I press the OK button, I wait 10
> seconds and then see all the layers.
>
> Any ideas?
>
> Thanks,
> Hershel
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to