什么是之间和LT的差异;%%GT;和< SCRIPT LANGUAGE =" VBScript的" RUNAT ="服务器">在传统的ASP?

编程入门 行业动态 更新时间:2024-10-27 08:32:12
本文介绍了什么是之间和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>

此页面上

www.newobjects/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.

    更多推荐

    什么是之间和LT的差异;%%GT;和&lt; SCRIPT LANGUAGE =&QUOT; VBScript的&QUOT; RUNAT =&QUOT;服务器&

    本文发布于:2023-06-08 03:57:30,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/576205.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:差异   传统   服务器   lt   SCRIPT

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!