当前位置: 移动技术网 > IT编程>开发语言>其他编程 > 如何使用数组来显示下拉菜单?

如何使用数组来显示下拉菜单?

2017年12月08日  | 移动技术网IT编程  | 我要评论

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

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网