商务合作:179001057@qq.com

带有文件域和下拉列表的表单无法通过按钮提交到servlet

技术2022-05-12  0


某平台价值19860元的编程课程资料免费领取【点我领取】


    

提交页面为:

 

<script type="text/javascript">     function submit1(){         if(document.f1.name.value.length>0 && document.f1.ges.value.length>0&& document.f1.fname.value.length>0){             document.f1.submit();        }         else{             alert("带*的不能为空!")         }     }     function onlyNum(){         if(!((event.keyCode>=48 && event.keyCode<=57) || (event.keyCode>=96 && event.keyCode<=105) || (event.keyCode==8))){             event.returnValue=false;         }     }     </script>

</head>

<body>

   <form action="servlet/FUServlet" name=f1  method="post" enctype="multipart/form-data">        <table width="326" height="314" border="0" align="center">          <tr>            <th height="76" colspan="3" scope="row"><font color="#5fdebb"><span class="STYLE1">请输入要上传的资源!</span></font></th>          </tr>          <tr>            <th width="71" align="left" scope="row"><font size="2"><span class="STYLE4"> 文件名 :</span></font></th>            <td align="left" colspan="2"><label>              <input type="text" name="name" id="name" />             </label><font color="#ff8040">*</font></td>          </tr>          <tr>            <th align="left" scope="row"><font size="2"><span class="STYLE4">文件格式:</span></font></th>            <td align="left" colspan="2"><label>              <select name="gs" id="gs">                <option value="文本">文本</option>                <option value="文本">图片</option>                <option value="音频">音频</option>                <option value="视频">视频</option>              </select>            </label><font color="#ff8040">*</font></td>          </tr>          <tr>            <th align="left" scope="row"><font size="2"><span class="STYLE4">文件路径:</span></font></th>            <td align="left" colspan="2"><label>              <input type="file" name="fname" id="fname" />            </label></td>          </tr>          <tr>            <th scope="row"> </th>            <td width="97"><label>             <input type=button value="上传" onClick="submit1()">            </label></td>            <td width="136"><label>              <input type=button value="重填" onClick="document.f1.reset()">            </label></td>          </tr>        </table>      </form>

</body>

 

提交之后表单为空时弹出了对话框提示,但输入相应数据后再提交,网页无反应,控制台也捕捉不到异常,不会是Servlet的原因吧


最新回复(0)