为什么 这个 VB脚本的 FOR循环 步长为2??

来源:百度知道 编辑:UC知道 时间:2024/05/17 00:05:35
<select name="month" id="month">
<option selected value="">请选择</option>
<%for i=1 to 12 step 1 %>
<%response.write "<option value="">"%> <%=i%> <%response.write"</option>"%>
<%next
%>
</select>
下拉框显示的是 2 4 6 8 10 12 6个数字 我希望是步长为1的显示
1~12
for i=1 to 12
这种方式 不行的

步长是1,可是你的写法不对,

<%response.write "<option value="">"%> <%=i%> <%

上面的value ="",应该改为value=''
双引号被以为是字符串的结束所以不对了,改成单引号就对了

<select name="month" id="month">
<option selected value="">请选择</option>
<%for i=1 to 12%>
<%response.write "<option value="">"%> <%=i%> <%response.write"</option>"%>
<%next
%>
</select>