By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,422 Members | 1,615 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,422 IT Pros & Developers. It's quick & easy.

Javascript execution sequence problem

P: n/a
Hello people!

I have a really weird problem here...
Let's say i have 4 lines of codes in a function like this one:
SomeSVGDialog.Show(); //this is an SVG dialog box that shows to give
some feedback
FunctionCall1(); //these functions calls webforms via XMLHTTP and
erform stuff
FunctionCall2();
FunctionCall3();
SomeSVGDialog.Hide();//thide the feedback window

OK... The way I see it, the normal sequence of events would be, the
feedback form is displayed, then, FunctionCall1, FunctionCall2 and
FunctionCall3 are executed and then the feedback window would hide,
right?

WRONG!!!
Right now, the feedback window isnt even displayed...
all operations are performed but i dont see the feedback form showing
up...
I have found a quick fix to that but its not really pretty...
I am doing this:

SomeSVGDialog.Show();

var DisplayTimer = setTimeout("FunctionCall1();FunctionCall2();Functi onCall3();SomeSVGDialog.Hide();",
500);

this work perfectly!!

Someone told me it may be because i am running the client javascript
code on a machine with multiple processors... Which is correct but i
didnt have the opportunity to test it on a single processor machine
yet...
In any case, id like to know if someone knows why this happens and how
to fix it if possible because i cannot assume users will all have
single CPU machines...

Thanks in advance!

Stephan Parrot
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Ron
"Stephan Parrot" <ka*****@hotmail.com> wrote in message
news:35**************************@posting.google.c om...
Hello people!

I have a really weird problem here...
Let's say i have 4 lines of codes in a function like this one:
SomeSVGDialog.Show(); //this is an SVG dialog box that shows to give
some feedback
FunctionCall1(); //these functions calls webforms via XMLHTTP and
erform stuff
FunctionCall2();
FunctionCall3();
SomeSVGDialog.Hide();//thide the feedback window

OK... The way I see it, the normal sequence of events would be, the
feedback form is displayed, then, FunctionCall1, FunctionCall2 and
FunctionCall3 are executed and then the feedback window would hide,
right?

WRONG!!!
Right now, the feedback window isnt even displayed...
all operations are performed but i dont see the feedback form showing
up...
I have found a quick fix to that but its not really pretty...
I am doing this:

SomeSVGDialog.Show();

var DisplayTimer = setTimeout("FunctionCall1();FunctionCall2();Functi onCall3();SomeSVGDialog.Hi
de();", 500);

this work perfectly!!

Someone told me it may be because i am running the client javascript
code on a machine with multiple processors... Which is correct but i
didnt have the opportunity to test it on a single processor machine
yet...
In any case, id like to know if someone knows why this happens and how
to fix it if possible because i cannot assume users will all have
single CPU machines...

Thanks in advance!

Stephan Parrot


Stephen,

What happens if you add an Alert() to stall the program flow after the
window open routine?

I'm wondering if the time taken to launch the new window is more than the
time taken to execute the other functions, so the window closes before you
get to see it.
Your workaround with a timer tends to support this.
how about just commenting out the close window ? What happens then.

HTH

Ron
Jul 23 '05 #2

P: n/a
Hi Ron, thanks for the reply!

Ok... I tried to remove the .Hide call and the window is displayed after
the 3 functions call after it...

I've put alerts too... Before and after... went ok... sequentially...
So... Either its the svg viwer pluggin that takes too much time to
generate the svg from the javascript OR it's because the viewer wait for
the function to exit before drawing it on screen... You know?
The function must be interpreted entirely before letting the viewer do
his job...

In any ways, i'm stuck with the timer solution right now and i'm not
happy with it...

I'll do some other tests and try to speak with guys from the svg
community if they know about that problem...

If you have some explanation for me or anything that could be helpfull,
please let me know!

If i find the solution or if someone directs me to one, ill let the
forum know.

Thanks a lot!

Stephan Parrot

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.