js代码:
function queryAgentInfo(){
<pre name="code" class="javascript"><span style="white-space:pre"> </span>//标记
<pre name="code" class="javascript"><span style="white-space:pre"> </span>var flag = false;
//遍历所有月份
$(".month").each(function(){
if($(this).hasClass("LabelSelected")){
flag = true;
}
});
//获取选中的年份
if(flag){
var yearList= $('input:radio[name="createTimeYear"]:checked').val();
if(yearList==null || yearList == ""){
alert("请选择一个年份!");
return false;
}
}
$("#result_list").empty();
$("#result_list").load("${ctx}/agent/<span style="font-family: Arial, Helvetica, sans-serif;">queryAgentInfo</span><span style="font-family: Arial, Helvetica, sans-serif;">.do",$("#agent_seach_form").serializeJson());</span>
}
HTML代码:
<dl class="clearfix">
<dt>年份:</dt>
<dd>
<span><input name="createTimeYear" type="radio" value="" checked="checked">不限</span>
<span><input id="1" name="createTimeYear" type="radio" value="2015" >2015年</span>
<span><input id="2" name="createTimeYear" type="radio" value="2016" >2016年</span>
</dd>
</dl>
<dl class="clearfix">
<dt>月份:</dt>
<dd>
<span>
<input id="a_0" name="createTimeMonths" type="checkbox" value="1,2,3" class="CheckBoxClass">
<label for="a_0" class="CheckBoxLabelClass">不限</label>
</span>
<span>
<input id="a_1" name="createTimeMonths" type="checkbox" value="1" class="CheckBoxClass">
<label class="CheckBoxLabelClass month" for="a_1">1月</label>
</span>
<span>
<input id="a_2" name="createTimeMonths" type="checkbox" value="2" class="CheckBoxClass">
<label class="CheckBoxLabelClass month" for="a_2">2月</label>
</span>
<span>
<input id="a_3" name="createTimeMonths" type="checkbox" value="3" class="CheckBoxClass">
<label class="CheckBoxLabelClass month" for="a_3">3月</label>
</span>
</dd>
</dl>