开发者

Javascript : problem in html page rendering

开发者 https://www.devze.com 2023-02-17 06:43 出处:网络
when i am rendering a page I have a confirm button that pops up before the page is fully rendered . now if i delay in choosing an option from the confirm box my page is left half rendered and if i sel

when i am rendering a page I have a confirm button that pops up before the page is fully rendered . now if i delay in choosing an option from the confirm box my page is left half rendered and if i select an option from the confirm box quickly the page is fully rendered. Why is this ha开发者_C百科ppening?


Because browsers read web page from top to bottom and execute javascript on the way. You should use < body onload="yourfunction()" > to display your confirm box after page loaded completely. Or you can use jquery .ready function:

http://api.jquery.com/ready/

0

精彩评论

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