日期:2014-05-17  浏览次数:21177 次

<%...%>里运用javascript时怎么不行呢?
HTML code

<%
dim a2
a2="<script language=""javascript"" type=""text/javascript"">var bb=new Array("11","12","13","15","21","22","23","31","32","33","34","35","36","37","41","42","43","44","45","46","50","51","52","53","54","61","62","63","64","65","71","81","82");""</script>"
%>



------解决方案--------------------
VBScript code

<%
dim a2
Set s = CreateObject("MSScriptControl.ScriptControl")
s.Language = "javascript"
a2 = s.Eval("new Array(1,2,3)")
Response.Write(a2)
%>

------解决方案--------------------
VB code
<%
dim a2
a2="<script language=""javascript"" type=""text/javascript"">var bb=new Array(11,12,13,15,21,22,23,31,32,33,34,35,36,37,41,42,43,44,45,46,50,51,52,53,54,61,62,63,64,65,71,81,82);alert(bb)</script>"
Response.write a2
%>

------解决方案--------------------
你这个是ASP吧。。。我的领域主要是J2EE,不是很清楚ASP的语法。未必能帮到你。

不过我猜测,split应该是对字符串有效的,bb是个Array,本来就是数组,没必要分割,此外也应该没有split这个函数吧?
------解决方案--------------------
HTML code

--不过我这个是vb.net,asp应差不多吧,结果应是正常的
--还有你14楼的想法就错误的,a2是服务器变量,你想取执行结果应是bb才是js变量
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <%
        Dim a2 As String
        a2 = "<script language='javascript' type='text/javascript'>var bb=new Array(11,12,13,15,21,22,23,31,32,33,34,35,36,37,41,42,43,44,45,46,50,51,52,53,54,61,62,63,64,65,71,81,82);</script>"
        Response.Write(a2)
    %>
    <script type="text/javascript">
    alert(bb.join("-"));
    </script>
</head>
<body>
    <form id="form1" runat="server">
    
    </form>
</body>
</html>