首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

jsp调用javascript中的函数出现submit异常

2012-03-02 
jsp调用javascript中的函数出现submit错误JSP页面如下:错误是:当点击删除按钮时document.afficheForm.subm

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 "
          class= "moduleName ">
          公告管理
        </td>


        <td>
          <img   src= " <%=request.getContextPath()%> /images/general/3.JPG "   width= "320 ">
        </td>
      </tr>
    </table>
    <table   width= "760 "   height= "30 "   border= "0 "   cellpadding= "1 "
      cellspacing= "1 "   class= "top ">
      <tr   align= "right ">
        <td   class= "Background ">
          <input   type= "button "   value= "删     除 "   onclick= "del() ">
        </td>
      </tr>
    </table>
    <table   width= "760 "   border= "0 "   cellpadding= "0 "   cellspacing= "0 "
      bgcolor= "#ffffff ">
      <tr>
        <td   height= "8 ">
        </td>
      </tr>
    </table>
    <table   width= "760 "   border= "1 "   cellpadding= "0 "   cellspacing= "0 "
      bordercolor= "#99CCFF ">
      <tr   align= "center ">
        <td   class= "Background2 "   width= "120 "   align= "center ">
          公告标题
        </td>
        <td   class= "Background2 "   width= "100 "   align= "center ">
          公告类别
        </td>
        <td   class= "Background2 "   width= "100 "   align= "center ">
          发布日期
        </td>
        <td   class= "Background2 "   width= "100 "   align= "center ">
          有效天数
        </td>
        <td   class= "Background2 "   width= "200 "   align= "center ">
          详细信息
        </td>
        </tr>
      <logic:present   name= "afficheList ">
        <logic:iterate   id= "afficheInfo "   name= "afficheList ">
          <tr   align= "center ">
            <td>
              <input   type= "checkbox "   name= "AfficheId "
                value= " <bean:write   name= "afficheInfo "   property= "affi_id "/> ">
            </td>
            <td>


              <bean:write   name= "afficheInfo "   property= "affi_title "> </bean:write>
            </td>
            <td>
              <bean:write   name= "afficheInfo "   property= "affi_words_for_sort "> </bean:write>
            </td>
            <td>
              <bean:write   name= "afficheInfo "   property= "affi_releasedate "> </bean:write>
            </td>
            <td>
              <bean:write   name= "afficheInfo "   property= "affi_effective_days "> </bean:write>
            </td>
            <td>
              <bean:write   name= "afficheInfo "   property= "affi_affiche_text "> </bean:write>
            </td>
            </tr>
        </logic:iterate>
      </logic:present>
    </table>
      </html:form>
</body>
</html:html>  


[解决办法]
很有可能是页面上有name为submit的元素

热点排行