日期:2014-05-16 浏览次数:20379 次
Ajax.FileUpload = function (url, fileId, SuccessDo) { var imageLoad; var imageLoadParent; var myform = document.createElement("form"); myform.style.display = "none"; myform.action = url; myform.enctype = "multipart/form-data"; myform.method = "post"; var is_chrome = /chrome/.test(navigator.userAgent.toLowerCase()); if (is_chrome && document.getElementById(fileId).value == '') return; //Chrome bug onchange cancel if (document.all || is_chrome) {// IE imageLoad = document.getElementById(fileId); imageLoadParent = document.getElementById(fileId).parentNode; myform.appendChild(imageLoad); document.body.appendChild(myform); } else { //FF imageLoad = document.getElementById(fileId).cloneNode(true); myform.appendChild(imageLoad); document.body.appendChild(myform); } $(myform).ajaxSubmit({ success: function (responseText) { //这里请对应修改上传文件返回值,不要轻易把我删掉 var res = responseText.split('|'); alert(res[1]); if (res[0] == 1) { $(".k-close").click(); $(".k-window,.k-overlay").remove(); SuccessDo(); } } }); }