现象:js报错或者按钮需要点击两次才有效
报错信息如下:
解决方法:jquery.uploadify.min.js
原代码:
SWFUpload.prototype.cleanUp = function(a) {
try {
if (this.movieElement && typeof(a.CallFunction) === "unknown") {
this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
for (var c in a) {
try {
if (typeof(a[c]) === "function") {
a[c] = null
}
} catch(b) {}
}
}
} catch(d) {}
window.__flash__removeCallback = function(e, f) {
try {
if (e) {
e[f] = null
}
} catch(g) {}
}
};
解决后代码:
SWFUpload.prototype.cleanUp = function(f) {
try {
if (this.movieElement && typeof(f.CallFunction) === "unknown") {
this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
for (var h in f) {
try {
// 只有这里加了个条件 【 && h[0] >= 'A' && h[0] <= 'Z'】
if (typeof(f[h]) === "function" && h[0] >= 'A' && h[0] <= 'Z') {
f[h] = null;
}
} catch(e) {}
}
}
} catch(g) {}
window.__flash__removeCallback = function(c, b) {
try {
if (c) {
c[b] = null;
}
} catch(a) {}
};
};
注意事项:一定要注意自己项目中是引入的哪个js文件,然后修改对应用到的js文件即可!
jquery.uploadify.js
jquery.uploadify.min.js
其他:使用uploadify插件实现上传时,需要把swf文件和其他所有js,css文件放到当前项目的同一个目录下