开发者

Javascript execution sequence

The SO question (load-and-execution-sequence-of-a-web-page)gives details into the order of execution of html page. It states - that the script tag is executed 开发者_如何学Pythonsequentially with single thread.

I have the following code on my page:

if(booleanTest)eval('parent.'+callback+'();');
     parent.hideWin();
     return false;

Assuming that the callback method is having a simple while loop that ran for a large number of times (eg : 30K times), I noticed that the hideWin was getting executed even before the callback even completed.(Tested on IE7)

The point is - if the execution is sequential then why is the above behavior in place - is it something specific to browser?.


yeah, the second line will execute only after the if+eval. i would do an alert before hidewin to check if booleanTest and any other state is the expected vals

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜