开发者

setTimeout in select box change event

When I have autopostback set to true on a select box, why is the 'setTimeout' ne开发者_如何学Ccessary in the onchange event? Why isn't __doPostBack just called directly?

onchange="javascript:setTimeout('__doPostBack(\'ctl00$myselect\',\'\')', 0)" 


From MSDN:

The JavaScript setTimeout method is used with the _doPostBack method to ensure that the user action completes before the postback occurs.


I was wondering the same thing - and I cynically thought the evasive MSDN explanation might mean "working around a bug in IE".

It seems this is the case! There's a race hazard in the threads handling the "use action":

http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/958a24b7-775e-434b-9fd4-58f72ecbb759

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜