如何使用数组来显示下拉菜单?
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
上一篇: 真是戏精