简体   繁体   中英

Javascript : problem in html page rendering

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 happening?

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM