vbscript mid函数问题

来源:百度知道 编辑:UC知道 时间:2024/09/22 07:47:53
<%
tyds=",10,20,30"
response.write(tyds)
response.write("<br>")
for i=1 to 3
on error resume next ‘不加这个就报告最后一句MID函数有问题,为了调试我加了这个看 哪里出错
tyds=mid(tyds,InStrRev(tyds, ",")+1)
response.write(tyds)
tyds=mid(tyds,1,InStrRev(tyds, ",")-1)
next
%>
预计想显示
10
20
30
刊物是显示的都是
30
30
30
怎么回事?

tyds=mid(tyds,InStrRev(tyds, ",")+1) '这句少个参数

可以这么用split函数来做更简单:

<%
tyds=",10,20,30"
response.write(tyds)
response.write("<br>")
arr=split(tyds,",")
For i=1 to 3
response.write(arr(i)&"<br>")
Next
%>