easyui版本 1.5.5.4
$.extend($.fn.filebox.defaults,{
onChange:function(newV,oldV){
if(newV=='')return;
var expArr = ['.jpg','.gif','.png','.jpeg','.doc','.docx','.xls','.csv','.xlsx','.ppt','.zip','.rar','.7z','.txt'];
var isValidate = false;
for(x in expArr){
if(newV.slice(-expArr[x].length)==expArr[x]){
isValidate = true;
break;
}
}
if(!isValidate){
util.clearFileBoxByJObj($(this));
alert('选择文件类型错误');
}
}
});
util.clearFileBoxByJObj = function(jqueryObj){
jqueryObj.next().children('input:first').val('');
jqueryObj.next().children('input:last').val('');
}