gpt4 book ai didi

javascript - 如何在asp响应中添加数字

转载 作者:行者123 更新时间:2023-12-03 12:37:15 25 4
gpt4 key购买 nike

我对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 等等???

最佳答案

增加计数器变量。您还需要一个“;”

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] = 是一种替代方案。

关于javascript - 如何在asp响应中添加数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23683172/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com