Add event handler for body.onload by javascript within <body> part

后端 未结 5 833
深忆病人
深忆病人 2020-12-13 18:10

We want to include a maps from Google Maps API in our document. The documentation tells to initialize the map with a function called by the onload() event of the body.

5条回答
  •  半阙折子戏
    2020-12-13 18:49

    You should really use the following instead (works in all newer browsers):

    window.addEventListener('DOMContentLoaded', init, false);
    

提交回复
热议问题