$(".width120").unbind("change");
             $(".width120").change(function () {
                 var id = $(this).attr("id");
                 id = (id.split("-"))[1];
                 if ($("#hid-"  id).val() == "false") {//文件不在上传状态
                     if ($("#file-"  id).val() != "") {
                         $("#hid-"  id).val("true")
                         $("#UpLoadForm-"  id).ajaxSubmit({
                             success: function (html, status) {
                                 var result = html.replace("<pre>", "");
                                 result = result.replace("</pre>", "");
                                 var img = (result.split(">"))[1];
                                 $("#image-"  id).attr('src', img);
                                 $("#loding-"  id).text("完成");
                                 list = $(".file");
                                 var isok = true;
                                 for (var i = 0; i < list.length; i ) {
                                     if (list[i].value == "") {
                                         isok = false;
                                     }
                                 }
                                 if (isok) {//添加新的控件
                                     id ;
                                     $("#new").append("<form id='UpLoadForm-"  id  "' name='UpLoadForm' method='post' enctype='multipart/form-data' action='Update.ashx'><table border='0' cellpadding='0' cellspacing='0' class='upp'><tr><td><input class='width120' type='file' id='file-"  id  "' name='flUpload' /><p style='display:inline;' id='loding-"  id  "'>未上传</p><input id='hid-"  id  "' type='hidden' value='false'><image style='display:inline;width:100px;height:50px;' id='image-" id "'/></div><br/></td></tr></table></form>");
                                     add();
                                 }
                             }
                         });
                     } else {
                         alert("请先选择文件!");
                     }

 
  
					
				
评论