日期:2014-05-17  浏览次数:20859 次

select,checkbox的值怎么获取?
请问下select下的option要排序嘛?比如 <option1> ......同时select里的值怎么获取?通过value?还有就是checkbox的值如何获取,尤其是多个选项时怎么获取?

------解决方案--------------------
<select name= "select1 ">
<option value=1> 1111 </option>
<option value=2> 2 </option>
</select>

这样后,直接用request.form( "select1 ")来获取
<input type= "checkbox " value= "a " name= "ch "> <input type= "checkbox " name= "ch " value= "b ">
这样直接用request.form( "ch ")来获取值(注意checkbox两个名字[name]要一样)

------解决方案--------------------
<form action= "test.asp " method= "post ">
<select name= "s ">
<option value= "option1 "> 1
<option value= "option2 "> 2
<option value= "option3 "> 3
</select>
<br>
<input type= "checkbox " name= "cb " value= "checkbox1 "> 1
<input type= "checkbox " name= "cb " value= "checkbox2 "> 2
<input type= "checkbox " name= "cb " value= "checkbox3 "> 3
<br>
<input type= "submit ">
</form>


test.asp
-------------------

<%
Response.Write(Request.Form( "s "))
Response.Write( " <br> ")
Response.Write(Request.Form( "cb "))
%>

试试看就知道了