<% Function JSArray2(ary_A) Dim intI, intJ, strA, objT
strA = "[" For intI = 0 To UBound(ary_A) strA = strA & "[" For intJ = 0 To UBound(ary_A, 2) objT = ary_A(intI, intJ) If IsNumeric(objT) Then strA = strA & objT Else strA = strA & """" & objT & """" End If strA = strA & "," Next strA = Left(strA, Len(strA) - 1) & "]," Next strA = Left(strA, Len(strA) - 1) & "]" JSArray2 = strA End FunctionDim arrData(2, 2), intI, intJFor intI = 0 To UBound(arrData) For intJ = 0 To UBound(arrData, 2) arrData(intI, intJ) = intI Next NextarrData(1, 1) = "a3"Response.Write JSArray2(arrData) %>
也可以这样判断。If varType(objT) <> 8 Then
<script> var arr=[]; <% for i=1 to 2 dim str="'"; for j=1 to 2 str+=arrData(i,j) if j<2 then str+="," next str+="'" %> arr[<%=i-1%>]=[<%=str%>]; <%next%> </script> 别扭死了~~大概就是这样吧~~~
<% Dim intI,intJDim arrData(12,4)For intI=1 To 12 For intJ=1 To 4 arrData(intI,intJ) = intI Next NextResponse.write"<script defer>" & vbcrlf Response.write"var arrData = new Array(12)" & vbcrlf For intI=1 To 12 Response.write"arrData[" & intI & "] = new Array(4);" & vbcrlf For intJ=1 To 4 Response.write"arrData[" & intI & "][" & intJ & "] = " & arrData(intI,intJ) & ";" & vbcrlf Next Next Response.write"</script>" & vbcrlf %>
Function JSArray2(ary_A)
Dim intI, intJ, strA, objT
strA = "["
For intI = 0 To UBound(ary_A)
strA = strA & "["
For intJ = 0 To UBound(ary_A, 2)
objT = ary_A(intI, intJ)
If IsNumeric(objT) Then
strA = strA & objT
Else
strA = strA & """" & objT & """"
End If
strA = strA & ","
Next
strA = Left(strA, Len(strA) - 1) & "],"
Next
strA = Left(strA, Len(strA) - 1) & "]"
JSArray2 = strA
End FunctionDim arrData(2, 2), intI, intJFor intI = 0 To UBound(arrData)
For intJ = 0 To UBound(arrData, 2)
arrData(intI, intJ) = intI
Next
NextarrData(1, 1) = "a3"Response.Write JSArray2(arrData)
%>
var arr=[];
<%
for i=1 to 2
dim str="'";
for j=1 to 2
str+=arrData(i,j)
if j<2 then str+=","
next
str+="'"
%>
arr[<%=i-1%>]=[<%=str%>];
<%next%>
</script>
别扭死了~~大概就是这样吧~~~
Dim intI,intJDim arrData(12,4)For intI=1 To 12
For intJ=1 To 4
arrData(intI,intJ) = intI
Next
NextResponse.write"<script defer>" & vbcrlf
Response.write"var arrData = new Array(12)" & vbcrlf
For intI=1 To 12
Response.write"arrData[" & intI & "] = new Array(4);" & vbcrlf
For intJ=1 To 4
Response.write"arrData[" & intI & "][" & intJ & "] = " & arrData(intI,intJ) & ";" & vbcrlf
Next
Next
Response.write"</script>" & vbcrlf
%>