日期:2014-05-16  浏览次数:20401 次

新手求教checkbox问题!望大神指点下
<li style="list-style:none; float:left;"><label>是万恶<input type="checkbox" name="1" /></label></li>
<li style="list-style:none;float:left;"><label>阿瑟斯<input type="checkbox" name="2" /></label></li>
<li style="list-style:none;float:left;"><label>中心<input type="checkbox" name="3" /></label></li><a href="#" class="btn_buy" style="color:#fff; margin-top:5px; ">提交</font></a>

当我点击提交的时候怎么写才能知道我选择的是哪个checkbox?
求大神指导下 ,我纯新手!

------解决方案--------------------
一般写成
是万恶<input type="checkbox" name="checkbox1" value="是万恶" />
阿瑟斯<input type="checkbox" name="checkbox1" value="阿瑟斯" />

name属性相同。后台使用
request("checkbox1")就能得到选中的值
------解决方案--------------------
判断checkbox的属性是true 还是 false就行了


$a=$('checkboxid').attr('value')
if($a.is(":true"))
{
  do something
}else
{
   do something
}