The key to the problem is to convert the array to a string, with the elements of each array as a string, plus a newline carriage return, before displaying the confirm:
The background color in the code is the key point
<script type= "Text/javascript" >
$ (function () {
Gets the value of the selected check box
var checkedarray = new Array ();//Set the value of the selected checkbox
The number of Var count;//already selected
$ (' #btn_submit '). Click (function () {
checkedarray.length=0;
count=0;
$ (' [name=item]:checkbox:checked '). each (function () {
Checkedarray.push ($ (this). Val ());
count++;
});
if (checkedarray.length==0) {
Alert ("Check one at least.");
Return
}
Confirm (the value of the selected check box: "+" \ n "+checkedarray.join (" \ n ")+" \ n "+" check box selected: "+count);
});
})
</script>
Confirm when displaying the contents of an array, always take a comma-delimited solution