function busUpLoadImg(postUrl,id) { .......//省略部分不用修改 uploader.on(‘uploadSuccess‘, function(file) { $(‘#‘ + file.id).addClass(‘upload-state-done‘); //验证是否上传上传 oSuccess = true; }); //回调函数验证是否上传 var oSuccess = false; return function(){ return oSuccess; } }
<input type="text" /> <input type="submit" onclick="subMit()" />
function subMit(){ fn1 = busUpLoadImg("postUrl",1); fn2 = busUpLoadImg("postUrl",2); if(!(fn1() && fn2())){ layer.msg("请上传图片",{time:1500}); return false; } }
时间: 2024-10-05 08:04:41