如何使用数组来显示下拉菜单?
如何使用数组来显示下拉菜单?
发布时间:2016-12-29 来源:查字典编辑
摘要:SubDoDropDown(Arr(),strSelName,onchange,strSelected,strexclude)Dimiifs...

Sub DoDropDown(Arr(), strSelName, onchange, strSelected, strexclude)

Dim i

if strSelected <> "" then

swap arr, strSelected

end if

response.write "<select NAME='" & strSelName & "' SIZE=1 ONCHANGE='" & onchange & "'>"

For i = 0 To UBound(Arr)

If arr(i) <> "" And IsNull(Arr(i)) = FALSE and arr(i) <> strexclude Then

response.write "<OPTION VALUE=""" & Arr(i) & """>" & Arr(i) & "</OPTION>"

End If

Next

response.write "</select>"

End Sub

Sub Swap(Arr(), strSelected)

' 交换数组中的元素

Dim StoreString, i

For i = 0 To UBound(Arr)

If Arr(i) = strSelected Then

StoreString = Arr(i)

Arr(i) = Arr(0)

Arr(0) = StoreString

End If

Next

End Sub

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新编程10000问学习
热门编程10000问学习
编程开发子分类