<script type="text/javascript">
//指定允许的上传文件类型
var extArray = new Array(".doc",".docx",".wps",".dot");
function LimitAttach(form, file){
var allowSubmit = false;
if (!file){
return;
}
while (file.indexOf("") != -1){
file = file.slice(file.indexOf("") + 1);
}
var ext = file.slice(file.indexOf(".")).toLowerCase();
for (var i = 0; i < extArray.length; i++) {
if (extArray[i] == ext){
allowSubmit = true;
break;
}
}
if (allowSubmit){
form.submit();
}else{ //检测上传文件类型
alert("只能上传以下格式的文件:"+ (extArray.join("")) + "n请重新选择再上传.");
}
}
</script>