<%
'检查数组元素是否存在相同
Function IsHavaArray(TstAry())
Dim TstVar,i,j
TstVar=False
For i=0 To UBound(TstAry)
For j=0 To UBound(TstAry)
IF i<>j Then
IF TstAry(i)=TstAry(j) Then
TstVar=True
End IF
End IF
Next
Next
IsHavaArray=TstVar
End Function
Dim tAry(5)
tAry(0)="anc"
tAry(1)="sas"
tAry(2)="dasd"
tAry(3)="sas"
tAry(4)="ansc"
tAry(5)="aadsa"
IF IsHavaArray(tAry)=True Then
Response.Write "存在相同"
Else
Response.Write "不存在相同"
End IF
%>
嵌套循环即可搞定。