var ipResolveValue =[]; //定义一个空数组 $("input[name='ipResolve']:checked").each(function(){ //each为每个匹配元素规定运行的函数,匹配name="ipResolve"的复选框 ipResolveValue.push($(this).val()); //js push增加数组值 }); //alert(ipResolveValue.length==0 ?'你还没有选择任何内容!':ipResolveValue);