什么是之间和LT的差异;%%GT;和< SCRIPT LANGUAGE =" VBScript的" RUNAT ="服务器">在传统的ASP?
我无法找到网络上的多文档
I couldn't find much documentation on the web
到目前为止现在,明显的区别似乎是你不能使用混合的脚本标记的HTML和VBScript
so far now, the obvious difference seems to be that you cant mix html and vbscript using the "script" tag
例如,这是确定
<% public sub display_literal() %>
literal
<% end sub %>
但与脚本标记你应该
but with the script tag you should
<script language="vbscript" runat="server">
public sub display_literal2()
response.write "literal2</br>"
end sub
</script>
此页面上
http://www.newobjects.com/pages/ndl/ ALP / ASP-structure.htm
它说,
在传统的ASP写在页面的默认脚本语言脚本(即假设在&lt语言;%%>标签)的第二执行 - 例如上述&lt所有的脚本code;%%>标记毕竟在&lt初始化; SCRIPT RUNAT = SERVER ...>脚本。
In classic ASP the script written in the default script language for the page (i.e. the language assumed for the <% %> tags) is executed second - e.g. all the script code in <% %> tags is initialized after all the <SCRIPT RUNAT=SERVER ...> scripts.
但我做了一些测试,无法验证它...
but I made a couple of tests and couldn't verify it...
我这么问是因为我有一个脚本(我没有它在现在手),使用&LT;%%>给了我一个错误,将其更改为在&lt; script>标记解决了这个问题,但我想知道为什么....
I'm asking because I had a script (I don't have it at hand right now) that using <% %> gave me an error, changing it to the <script> tag solved the problem, but I'd like to know why....
反正,我想,我们应该使用在&lt; SCRIPT>的函数和过程标记,将被来自以下的调用;?%%>标签...权
anyway, I guess that we should use the <script> tag for functions and procedures that are to be called from <% %> tags... right?
首先你要明白,有一个在路上服务器端的差异剧本
标签的处理根据指定的语言是否相同的页的默认语言
First off you need to understand that there's a difference in the way server-side script
tags are handled depending on whether the language specified is the same as the default language for the page.
的顺序是这样的: -
The order is this:-
- 在
&LT运行的所有脚本;脚本RUNAT,其中指定的语言不匹配的默认语言=服务器
标记。这些文件的顺序执行。 - 运行默认脚本。这意味着执行隐含写到那里是在页面静态内容(东西不是在
=服务器的响应
标记或在&LT ; %%&GT;
)和任何中间code在&LT; %%方式&gt;
文档顺序显然再次 - 在
&LT发现全球范围内运行的任何code;脚本=服务器
标签,其中的语言默认脚本语言相匹配
- Run all scripts in
<script runat="server"
tags where the language specified does not match the default language. These are executed in document order. - Run the default script. That means perform the implied writes to the response where there is static content in the page (the stuff not in
runat="server"
tags or inside<% %>
) and any intervening code in<% %>
again in document order obviously. - Run any code at the global level found in
<script runat="server"
tags where the language matches the default script language.
请注意,所有的脚本具有从第1阶段调用执行阶段1,因此可以通过在第三阶段中运行的脚本来定义将任何可用的函数之前的初始解析。
Note that all script has an initial parse before executing phase 1, hence any functions that may be defined by scripts run in phase 3 will be available for calling from phase 1.