日期:2014-05-17  浏览次数:20807 次

嵌套的FORM,里面的FORM无法提交,
<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("请选择需要删除的头像");
    }
    function ok(){
var r=confirm("确定删除?");
     if (r==true)
     {
      document.photoform.submit();
     }
}
</script>




            <div style="width:1300px; float:left" align="left">
  <form action="PhotoServlet?action=delall" method="post" name="myform">
<%
for(int i = 0;i<photoList.getList().size() ;i++){
 Photo photo = photoList.getIndex(i);
 %>
                 <div style="width:200px; float:left; margin-left:50px" align="left">
                     <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>
                    </div>
                    <%
                     }
      &