js获取checkbox复选框的value

<scrīpt LANGUAGE="Javascrīpt">
<!--
function hs(){
var s = document.getElementsByName("chkStudent");
var s2 = "";
for( var i = 0; i < s.length; i++ )
{
if ( s[i].checked ){
s2 += s[i].value+'','';
}
}
s2 = s2.substr(0,s2.length-1);
alert(s2);
location.href = "delete.jsp?id="+s2; //这里传过去的是已逗号分隔开的id,需要在后面的页面内取出
}
//-->
</scrīpt>
<BODY>
<INPUT TYPE="checkbox" NAME="chkStudent" value=1>1<br>
<INPUT TYPE="checkbox" NAME="chkStudent" value=2>2<br>
<INPUT TYPE="checkbox" NAME="chkStudent" value=3>3<br>
<INPUT TYPE="checkbox" NAME="chkStudent" value=4>4<br>
<INPUT TYPE="checkbox" NAME="chkStudent" value=5>5<br>
<INPUT TYPE="button" value=''查看结果'' ōnclick="hs()">

PHP接收

<?php
$data['ab'] = '1,2,3,4,5,6,7,8,9';
$array=explode(',',$data['ab']); //转为数组
foreach( $array as $k=>$v){
echo $array[$k]['ab']."<br>";
}
?>