引用 jQuery的js
<script>
$(function(){ var arr = new Array(); $('#checkbox').click(function(){
arr = []; $("input[name='c']:checked").each(function(k,v){
arr.push($(this).val());
}); $('#arr').val(arr);
}); $('#radio').click(function(){
var vradio = $('input[name="r"]:checked').val();
alert(vradio);
});
}); </script>
html
<body>
<input type="checkbox" name="c" value="c1" id="" />c1
<input type="checkbox" name="c" value="c2" id="" />c2
<input type="checkbox" name="c" value="c3" id="" />c3
<input type="text" name="" value="" id="arr" />c3
<input type="button" value="checkbox" id="checkbox"/><br> <input type="radio" name="r" value="r1" id="" />r1
<input type="radio" name="r" value="r2" id="" />r2
<input type="radio" name="r" value="r3" id="" />r3
<input type="button" value="radio" id="radio"/>
</body>