[removed] seems to trigger before the DOM is loaded (JavaScript)

后端 未结 5 1476
我在风中等你
我在风中等你 2020-11-28 13:45

I am having trouble with the window.onload and document.onload events. Everything I read tells me these will not trigger until the DOM is fully loa

5条回答
  •  时光取名叫无心
    2020-11-28 14:21

    At the time window is loaded the body isn't still loaded therefore you should correct your code in the following manner:

    
    

    Tested to work in FF/IE/Chrome, although thinking about handling document.onload too.

    As already mentioned, using js-frameworks will be a far better idea.

提交回复
热议问题