request.getParameter复选框一直为null
jsp页面:
<script type="text/javascript">
function checkInvalidate(){
var chk = document.getElementsByName("chk");
for(var i=0;i<chk.length;i++){
if(chk[i].type=="checkbox"){
if(chk[i].checked==true){
var r=confirm("确定删除?");
if (r==true)
{
document.myform.submit();
return;
}else{
return;
}
}
}
}
alert("请选择需要删除的头像");
}
</script>
<form name="photoform" action="PhotoServlet?action=del&photoId=<%=photo.getId() %>" method="post">
<img
src="<%=photo.getPath() %>\<%=photo.getName() %>"
alt="${photo.shuoming }" width=150 height=113
border='0' align="middle"><br>
<input type="button" name="del" value="删除" onclick="ok();return false;" />
<input type="checkbox" name="chk" value="<%=photo.getId()%>">
</form>
<a href="javascript:checkInvalidate()" class="next">批量删除</a>
servlet动作:
String str[]=request.getParameterValues("chk");
str一直为NULL。。。这怎么破?