HTMLはinputチェックボックスの複数の値を取得します.
11104 ワード
<table>
<tr><td><input type="checkbox" value="0" οnclick="allChoice()" id="allCheck" name="checks"> td>tr>
<tr><td>td>tr>
<tr><td><input type="checkbox" value=" " name="checks" οnclick="oneChoice()"> td>tr>
<tr><td>td>tr>
<tr><td><input type="checkbox" value=" " name="checks" οnclick="oneChoice()"> td>tr>
<tr><td>td>tr>
<tr><td><input type="checkbox" value=" " name="checks" οnclick="oneChoice()"> td>tr>
<tr><td>td>tr>
<tr><td><input type="checkbox" value=" " name="checks" οnclick="oneChoice()"> td>tr>
<tr><td>td>tr>
<tr><td><input type="checkbox" value=" " name="checks" οnclick="oneChoice()"> td>tr>
<tr><td>td>tr>
<tr><td><input type="checkbox" value=" " name="checks" οnclick="oneChoice()"> td>tr>
table>
//
function oneChoice(){
var obj = $('[name="checks"]');
check_val = [];
for(k in obj){
if(obj[k].checked && obj[k].value != "0")
check_val.push(obj[k].value);
}
$("#sampling").val(check_val);
}