如何使用数组来显示下拉菜单?
时间:2010-05-16 15:19:00
如何使用数组来显示下拉菜单?
可以这样,如下:
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
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Golang验证器之validator是使用详解
![](https://img.aspxhome.com/file/2023/9/107319_0s.png)
你需要学会的8个Python列表技巧
![](https://img.aspxhome.com/file/2023/6/118616_0s.png)
Python中的条件判断语句基础学习教程
JS创建对象的写法示例
PyCharm利用pydevd-pycharm实现Python远程调试的详细过程
![](https://img.aspxhome.com/file/2023/4/115844_0s.png)
中英文双语导航菜单
![](https://img.aspxhome.com/file/UploadPic/20075/20075111747385s.gif)
windows 下python+numpy安装实用教程
解析sql语句中left_join、inner_join中的on与where的区别
RHEL7.5下mysql 8.0.11安装教程
MySql节点管理安装步骤
编写高质量代码的30条黄金守则(首选隐式类型转换)
![](https://img.aspxhome.com/file/2023/8/132338_0s.png)
python实现播放音频和录音功能示例代码
![](https://img.aspxhome.com/file/2023/5/133255_0s.png)
快速了解Python开发环境Spyder
![](https://img.aspxhome.com/file/2023/3/121123_0s.jpg)
python3爬虫怎样构建请求header
![](https://img.aspxhome.com/file/2023/7/68857_0s.png)
golang validator库参数校验实用技巧干货
Codeigniter控制器controller继承问题实例分析
PHP Laravel门面的实现原理详解
Mysql学习之数据库检索语句DQL大全小白篇
![](https://img.aspxhome.com/file/2023/1/118451_0s.png)
浅谈flask源码之请求过程
Python+pandas编写命令行脚本操作excel的tips详情
![](https://img.aspxhome.com/file/2023/9/76989_0s.png)