ASP中JavaScript和VBScript混用与runat=server时脚本语言的执行优先级

<%@language=”JavaScript”%>
<HTML><BODY>
1 HTML<br/>

<script language=”VBscript” runat=server>
response.write(“2 vbscript runat=server<br/>”)
</script>

3 HTML<br/>

<script language=”javascript” runat=server>
Response.Write(“4 javascript runat=server<br/>”);
</script>

5 HTML<br/>

<script language=”perlscript” runat=”server”>
$Response->Write(“6 perl runat=server<br/>”);
</script>

7 HTML<br/>

<%
Response.write(“8 inline script<br/>”);
%>

9 HTML<br/>

<script language=”javascript” runat=server>
Response.Write(“10 javascript runat=server<br/>”);
</script>

11 HTML<br/>

<script language=”VBscript” runat=server>
response.write(“12 vbscript runat=server<br/>”)
</script>

13 HTML<br/>

<script language=”perlscript” runat=”server”>
$Response->Write(“14 perl runat=server<br/>”);
</script>

</BODY></HTML>

这次的结果是:

2 vbscript runat=server
12 vbscript runat=server
6 perl runat=server
14 perl runat=server
1 HTML
3 HTML
5 HTML
7 HTML
8 inline script
9 HTML
11 HTML
13 HTML
4 javascript runat=server
10 javascript runat=server

这次最慢的的是javascript runat=server,所以可以证明上面的结论是正确的。

« »