慕码人8056858
<div id="dvCB">
<script>
for (var i = 1; i < 12; i++) document.write('<input type="checkbox" value="'+i+'"/>'+i+' ')
</script>
</div>
<script>
var values = '2,3,1,10';///将你原来获取到的值放到这个js变量里面,如values='<%=yourVar%>'
values = ',' + values + ',';
var cbs = document.getElementById('dvCB').querySelectorAll('input');
for (var i = 0; i < cbs.length; i++) if (values.indexOf(',' + cbs[i].value + ',') != -1) cbs[i].checked = true;
</script>