JQ判断按钮,复选框是否选中
var oRdoValue=$("#Radio1").is (":checked")?"男":"女"; //获取单选框按钮值 var oChkValue=$("#Checkbox1").is (":checked")?"已婚":"未婚";//获取复选框按钮值
性别:<input id="Radio1" name="rdoSex" type="radio" value="男" />男 <input id="Radio2" name="rdoSex" type="radio" value="女" />女<br /> 婚否:<input id="Checkbox1" type="checkbox" />
<td align="center" valign="middle"> <input type="checkbox" id="selall" onclick="doCheckClick()"/>全选 </td> <input name="simUnitCodeList" type="checkbox" value='EA04' />中货航 <input name="simUnitCodeList" type="checkbox" value='EA08' />山东 <input name="simUnitCodeList" type="checkbox" value='EA06' />江西 <input name="simUnitCodeList" type="checkbox" value='EA16' />四川 <input name="simUnitCodeList" type="checkbox" value='EA17' />上航 <input name="simUnitCodeList" type="checkbox" value='EA12' />西北
function doCheckClick(){
$('input[name="simUnitCodeList"]').attr("checked", $("#selall").is (":checked"));
}