使用此脚本
<script type="text/javascript">var array = []; $('#item').live('click', function() {if ($(this).attr('checked')) { // Add the new element if checked: array.push($(this).attr('value')); document.getElementById('hidden_field').value=array.join(','); } else { // Remove the element if unchecked: for (var i = 0; i < array.length; i++) { if (array[i] == $(this).attr('value')) { array.splice(i, 1); } } }});</script>


