把javascript放在标头之外有多糟糕? [英] How bad is it to put javascript outside of the header?
问题描述
这个问题已经说明了一切。
我开始向我的周末项目</a>。这是一个很小的应用程序给我和几个朋友,因为我们交换学生对我们有用。
但事情是以下,我在做这在PHP和结构化所有包含所有我可以得到代码分离。这些代码中的一些代码依赖于javascripts狙击手,所以在身体的中间放置一个javascript有多糟糕?或者我应该做双重包括,所以javascript保持在标题?
这不是坏的。
The question pretty much already says everything.
I'm starting to add some features to my weekend project. It's a small app for me and a couple of friends, as we're exchange students it's kinda useful for us.
But the thing is the following, I'm doing this in php and structuring everything with includes so i can get the code separated. Some of these pieces of code are dependent on javascripts snipets, so how bad is it to put a javascript in the middle of the body? Or should i just make double includes so the javascript stays in the header?
It's not bad at all.
It's actually considered good practice to put your script tags as late as possible in the page.
这篇关于把javascript放在标头之外有多糟糕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!