我是asp的新手。这是我的代码:
response.write("<script>")
do until rs.EOF
for each x in rs.Fields
response.write(" var ")
response.write("CC=" & x.value)
next
rs.MoveNext
loop
response.write("</script>")
如何使输出为var CC1= x.value
,然后让下一个循环返回var CC2=x.value
,依此类推???
答案 0 :(得分:1)
增加计数器变量。 你还需要一个“;”
response.write("<script>")
dim counter: counter = 0
do until rs.EOF
for each x in rs.Fields
counter = counter + 1
response.write "var CC" & counter & "=" & x.value & ";"
next
rs.MoveNext
loop
数组形式:var CC[];
... CC[counter] =
可以替代。