我写了一个多文件上传的东西!需要判断file 是否有值 !如果没有值刚页面不能提交!
<script type="text/javascript">
function getValue()
{
var x=document.getElementById("docId").value;
if(x=="")
{
alert("请选择文件");
} }
</script>
<form action="actions/modifyRecordAction!update?document.id=${document.id}" method="post" enctype="multipart/form-data" name="form1" onsubmit="return getValue()" >但在弹出alert()后页面还是会提交!
<script type="text/javascript">
function getValue()
{
var x=document.getElementById("docId").value;
if(x=="")
{
alert("请选择文件");
} }
</script>
<form action="actions/modifyRecordAction!update?document.id=${document.id}" method="post" enctype="multipart/form-data" name="form1" onsubmit="return getValue()" >但在弹出alert()后页面还是会提交!
getValue() ;return false;
{
var x=document.getElementById("docId").value;
if(x=="")
{
alert("请选择文件");
return false;
}
return true;
}
function getValue()
{
var x=document.getElementById("docId").value;
if(x=="")
{
alert("请选择文件");
return false;
}
return true;
}
</script>
加上红色的