asp“800a0009 下标越界", 请问如何解决?谢谢
MicrosoftVBScript运行时错误错误'800a0009'下标越界:'[number:0]'tes.asp,line223<%customer=split(re...
Microsoft VBScript 运行时错误 错误 '800a0009'下标越界: '[number: 0]'tes.asp, line 223<%customer=split(request("cs")," ")customer1=customer(0)customer2=customer(1) FirstWord=left(customer1,1)SecondWord=left(customer2,1)Response.Write FirstWord&SecondWord%>
展开
展开全部
这是由于传递过来的参数cs中不含有空格(或者根本就是空字符串),这样的话用split分割出来的数组customer的元素个数就会不足2个,因此customer(1)就会报“下标越界”了(如果是空字符串则customer(0)都会报错)。至于为什么会这样,就要你自己去排查了。
要想防止这样的错误,可以这样:
<%
if instr(request("cs")," ")>0 then
customer=split(request("cs")," ")
customer1=customer(0)
customer2=customer(1)
FirstWord=left(customer1,1)
SecondWord=left(customer2,1)
Response.Write FirstWord&SecondWord
end if
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询