JS正则 文件域里提交的文件名不能有中文

来源:百度知道 编辑:UC知道 时间:2024/06/07 06:05:38
验证提交的文件路径中的文件名不能含有中文,上传的文件格式是doc或docx
谢谢了

function yanzheng(){
var reg=/[^\u0000-\u00FF]/g;
var str = document.all.upload.value;
dd=str.indexOf(".")
var type = document.all.vvv.value.substring(dd+1, str.length);
if(reg.test(str) && (type == "doc" || type == "docx ")){
return true;
}
return false;
}