逗号分隔字符串在经典 asp 中放入下拉列表中



>我有一个逗号分隔的字符串假设 12345,67890,3453,124556,56778我想在下拉列表中显示这些项目

我正在一个经典的asp页面中工作。

请帮我这个

试一试:

<%
' put your string into a variable.
Dim myString : myString = "12345,67890,3453,124556,56778"
' split your variable up into a array
Dim splitmystring : splitmystring = split(myString,",")
' create a dropdown box
Response.write  "<select value=""dropdown"">"
Response.write  "<option selected>choose a option</option>"
' Loop through your array
For Each item In splitmystring
    response.write "<option value='"& item &"'>"& item & "</option>"
Next
'close your dropdown box
response.write "</select>"
%>

最新更新