html标签用js判断输入是否为空问题
js判断<scripttype="text/javascript">functionuploadValidate(){if(document.getElementsByI...
js判断
<script type="text/javascript">
function uploadValidate(){
if(document.getElementsById("uploadfileId").value==""){
alert("请输入文件名");
name.focus;
return false;
}
return true;
}
</script>
<html:form action="/fileuploadAction" enctype="multipart/form-data" method="post">
<tr>
<td align="right">请输入文件名:</td><td><input name="name" type="text" id="uploadfileId"/></td>
</tr>
<br/>
<tr>
<td align="right">请选择要上传的文件:</td><td><html:file property="formfile"></html:file></td>
</tr>
<br><tr>
<td align="right"><html:submit value="上传" onclick="return uploadValidate(); "/></td><td> <html:cancel value="取消"/></td>
</tr>
</html:form>
根本就没进入uploadValidate(),不进行判断直接提交表单了呢 展开
<script type="text/javascript">
function uploadValidate(){
if(document.getElementsById("uploadfileId").value==""){
alert("请输入文件名");
name.focus;
return false;
}
return true;
}
</script>
<html:form action="/fileuploadAction" enctype="multipart/form-data" method="post">
<tr>
<td align="right">请输入文件名:</td><td><input name="name" type="text" id="uploadfileId"/></td>
</tr>
<br/>
<tr>
<td align="right">请选择要上传的文件:</td><td><html:file property="formfile"></html:file></td>
</tr>
<br><tr>
<td align="right"><html:submit value="上传" onclick="return uploadValidate(); "/></td><td> <html:cancel value="取消"/></td>
</tr>
</html:form>
根本就没进入uploadValidate(),不进行判断直接提交表单了呢 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询