日期:2014-05-16  浏览次数:20316 次

jsp调用javascript中的函数出现submit错误
JSP页面如下:  

          错误是:当点击删除按钮时document.afficheForm.submit();就会出错说是对象不支持此属性或方法  

          用document.getElementById( "afficheForm ").submit();就不能批量删除  

        其他的地方是没错的  

        。。哪位指点下啊。。  

<%@   taglib   uri= "/WEB-INF/struts-bean.tld "   prefix= "bean "%>
<%@   taglib   uri= "/WEB-INF/struts-html.tld "   prefix= "html "%>
<%@   taglib   uri= "/WEB-INF/struts-logic.tld "   prefix= "logic "%>
<%@   page   language= "java "   pageEncoding= "UTF-8 "%>
<html:html>
<head>
  <title> 公告管理 </title>
  <link   href= " <%=request.getContextPath()%> /css/top.css "   rel= "stylesheet "   type= "text/css ">
  <link   href= " <%=request.getContextPath()%> /css/webstudy.css "   rel= "stylesheet "   type= "text/css ">
    <script   type= "text/javascript ">
          function   del(){
        var   ids   =   document.afficheForm.AfficheId;
        var   bool   =   false;
        if(ids   ==   null)   return;
        if(ids.length   ==   undefined)   bool   =   true;
        for(var   i=0;   i   <   ids.length;   i++){
          if(ids[i].checked){
              bool   =   true;
              break;
          }
        }        
        if(bool   ==   false){
          window.alert( "请选择要删除的公告! ");
          return;
        }
        document.afficheForm.action   =   " <%=request.getContextPath()%> /afficheManage.do?method=delByAffi_id ";
        //document.getElementById( "afficheForm ").submit();  

        //document.afficheForm.submit();
      }
  </script>
</head>
<body>
  <html:form   action= "/afficheManage.do?method=addAffiche "   method= "post ">
    <table   width= "760 "   border= "0 "   cellpadding= "1 "   cellspacing= "1 ">
      <tr   width= "760 "   height= "44 ">
        <td>
          <img   src= " <%=request.getContextPath()%> /images/general/1.JPG "   width= "320 ">
        </td>
        <td   width= "120 "   colspan= "5 "   align= "center "   bgcolor= "#F7FFFF "
        &