我有一個逗號分隔字符串 說12345,67890,3453,124556,56778 ,我想顯示一個下拉這些項目下拉列表逗號分隔字符串成滴在傳統的ASP下降
我的工作在一個經典的asp頁面中。
請幫我在這
我有一個逗號分隔字符串 說12345,67890,3453,124556,56778 ,我想顯示一個下拉這些項目下拉列表逗號分隔字符串成滴在傳統的ASP下降
我的工作在一個經典的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>"
%>
對於每個選項,它應該是'value =「...」'而不是'name =「...」。 –
乾杯暗影精靈你是完全正確的 – DevCentral
通過它創建,填補了選擇的選項的數組使用_split_功能和循環。玩的開心。 – AardVark71