是否有可能从值为“Name”的数组中获取值?

时间:2010-02-10 10:54:29

标签: asp-classic

这是我的数组

<%
Dim myFixedArray
myFixedArray(0) = "Albert Einstein"
myFixedArray(1) = "Mother Teresa"
myFixedArray(2) = "Bill Gates"
myFixedArray(3) = "Martin Luther King Jr."
%>

现在我用来获取价值是

<%
For i=0 to 3
response.write myArray(i) & "<br>" 
Next 
%>

我需要拿“比尔盖茨”数组编号

我需要resut是“2”

如何在循环中找到结果?

1 个答案:

答案 0 :(得分:1)

这个怎么样?

<% 
For i=0 to 3 
If myArray(i) = "Bill Gates" Then
 mynumber = i (or return i)
End If
Next  
%>