<脚本标记必须出现在< head section中吗? [英] Do <script tags have to appear in <head section?

查看:71
本文介绍了<脚本标记必须出现在< head section中吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我是javascript的新手。我有一个在.net中运行的网站,在default.aspx页面的< head部分中有一个

加载,

使页面大小增加到371kb。但是,其中许多只在一个皮肤或系统中的页面中使用

。有什么方法可以将这些

脚本放在别处,所以它们只在需要时加载。然后

每个网页都不一定要这么大?


这就是我所说的那种


< script type =" text / javascript" src ="<%= Page.ResolveUrl(" js /

swfobject.js")%>">< / script>


Stapes

Hi

I am new to javascript. I have a website running in .net, that has a
load of these in the <head section of the default.aspx page, which
bumps the page size up to 371kb. However, many of these are only used
in one ''skin'', or page in the system. Is there any way I can put these
scripts elsewhere, so they are only loaded when they are needed. Then
every webpage will not have to be so enormous?

This is the sort of thing I am talking about:

<script type="text/javascript" src="<%= Page.ResolveUrl("js/
swfobject.js") %>"></script>

Stapes

推荐答案

Stapes vient de nous annoncer:
Stapes vient de nous annoncer :

您好


我是javascript的新手。我有一个在.net中运行的网站,在default.aspx页面的< head部分中有一个

加载,

使页面大小增加到371kb。但是,其中许多只在一个皮肤或系统中的页面中使用

。有什么方法可以将这些

脚本放在别处,所以它们只在需要时加载。然后

每个网页都不一定要这么大?


这就是我所说的那种


< script type =" text / javascript" src ="<%= Page.ResolveUrl(" js /

swfobject.js")%>">< / script>


Stapes
Hi

I am new to javascript. I have a website running in .net, that has a
load of these in the <head section of the default.aspx page, which
bumps the page size up to 371kb. However, many of these are only used
in one ''skin'', or page in the system. Is there any way I can put these
scripts elsewhere, so they are only loaded when they are needed. Then
every webpage will not have to be so enormous?

This is the sort of thing I am talking about:

<script type="text/javascript" src="<%= Page.ResolveUrl("js/
swfobject.js") %>"></script>

Stapes



使用这种方法,你只需下载.js文件一次,每次

你的代码使用它,浏览器在客户端缓存中查找它没有?


看看这个

http://www.fiddlertool.com/fiddler/


它的html调试器


您可以获得有关页面所有流量和时间的信息,

表格和很多东西

using this method, you just download the .js file once, and every time
your code uses it, the browser looks for it in the client cache no?

take a look at this

http://www.fiddlertool.com/fiddler/

its a html debugger

you can get information about all the traffic and times of your pages,
forms and a lot of things


10月11日,10:40,matatunos< matatu ... @ gmail.comwrote:
On 11 Oct, 10:40, matatunos <matatu...@gmail.comwrote:

Stapes vient de nous annoncer:
Stapes vient de nous annoncer :


Hi


我是javascript的新手。我有一个在.net中运行的网站,在default.aspx页面的< head部分中有一个

加载,

使页面大小增加到371kb。但是,其中许多只在一个皮肤或系统中的页面中使用

。有什么方法可以将这些

脚本放在别处,所以它们只在需要时加载。然后

每个网页都不一定会如此庞大?
I am new to javascript. I have a website running in .net, that has a
load of these in the <head section of the default.aspx page, which
bumps the page size up to 371kb. However, many of these are only used
in one ''skin'', or page in the system. Is there any way I can put these
scripts elsewhere, so they are only loaded when they are needed. Then
every webpage will not have to be so enormous?


这就是我所说的


< script type =" text / javascript" src ="<%= Page.ResolveUrl(" js /

swfobject.js")%>">< / script>
<script type="text/javascript" src="<%= Page.ResolveUrl("js/
swfobject.js") %>"></script>


Stapes
Stapes



使用此方法,您只需下载.js文件一次,每次

你的代码使用它,浏览器在客户端缓存中查找它没有?


看看这个

http://www.fiddlertool.com/fiddler/


它的html调试器


您可以获得有关页面所有流量和时间的信息,

表格和很多东西


using this method, you just download the .js file once, and every time
your code uses it, the browser looks for it in the client cache no?

take a look at this

http://www.fiddlertool.com/fiddler/

its a html debugger

you can get information about all the traffic and times of your pages,
forms and a lot of things



肯定是一个http调试器?

Surely an http debugger?


10月11日,10:40 ,matatunos< matatu ... @ gmail.comwrote:
On 11 Oct, 10:40, matatunos <matatu...@gmail.comwrote:

Stapes vient de nous annoncer:
Stapes vient de nous annoncer :

Hi
Hi


我是javascript的新手。我有一个在.net中运行的网站,在default.aspx页面的< head部分中有一个

加载,

使页面大小增加到371kb。但是,其中许多只在一个皮肤或系统中的页面中使用

。有什么方法可以将这些

脚本放在别处,所以它们只在需要时加载。然后

每个网页都不一定会如此庞大?
I am new to javascript. I have a website running in .net, that has a
load of these in the <head section of the default.aspx page, which
bumps the page size up to 371kb. However, many of these are only used
in one ''skin'', or page in the system. Is there any way I can put these
scripts elsewhere, so they are only loaded when they are needed. Then
every webpage will not have to be so enormous?


这就是我所说的


< script type =" text / javascript" src ="<%= Page.ResolveUrl(" js /

swfobject.js")%>">< / script>
<script type="text/javascript" src="<%= Page.ResolveUrl("js/
swfobject.js") %>"></script>


Stapes
Stapes



使用此方法,您只需下载.js文件一次,每次

你的代码使用它,浏览器在客户端缓存中查找它没有?


看看这个

http://www.fiddlertool.com/fiddler/


它的html调试器


您可以获得有关页面所有流量和时间的信息,

表格和很多东西


using this method, you just download the .js file once, and every time
your code uses it, the browser looks for it in the client cache no?

take a look at this

http://www.fiddlertool.com/fiddler/

its a html debugger

you can get information about all the traffic and times of your pages,
forms and a lot of things



对不起 - 我没看到你答案的相关性

Sorry - I don''t see the relevance of your answer


这篇关于&lt;脚本标记必须出现在&lt; head section中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆