且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

网页底部/顶部的JavaScript?

更新时间:2023-11-02 17:17:40

它会允许在执行JavaScript之前可以明显加载的网页,这对于像Google Analytics这样的内容是有意义的,这些内容在页面加载之前不需要发生。

It'll allow the web page to load visibly before executing JavaScript, which makes sense for things like Google Analytics, which don't need to happen before the page loads.

您可能还想要查看jQuery,prototype等内容并附加到ready处理程序,该处理程序在DOM完全加载后执行JavaScript代码,这是适用于大量JavaScript代码的地方。

You may also want to look into things like jQuery, prototype, etc and attach to the "ready" handler, which executes JavaScript code after the DOM has been fully loaded, which is an appropriate place for much JavaScript code.