我有一个swfUpload实例,我希望在成功上传后消失。我尝试了destroy方法,但它引起了很多javascript问题。所以我做的是当uploadSuccess事件触发时我得到了我的div并将它的显示设置为none。然后我设置另一个div的innerHTML以显示上传视频的缩略图。它可以在除了Internet Explorer之外的每个浏览器上正常工作,它显示:
消息:
引发异常而未捕获行:451字符:2代码:0 URI:/js/swfupload/swfupload.js
并且我的表单的提交按钮不起作用。
这是错误的功能
SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
argumentArray = argumentArray || [];
var movieElement = this.getMovieElement();
var returnValue, returnString;
// Flash's method if calling ExternalInterface methods (code adapted from MooTools).
try {
returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
returnValue = eval(returnString);
} catch (ex) {
throw "Call to " + functionName + " failed";
}
// Unescape file post param values
if (returnValue != undefined && typeof returnValue.post === "object") {
returnValue = this.unescapeFilePostParams(returnValue);
}
return returnValue;
};
uploadSuccess事件:
function uploadSuccess(file, serverData) {
if (serverData != "")
{
this.uploadError(file, SWFUpload.UPLOAD_ERROR.HTTP_ERROR, serverData);
}
else
{
try {
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setComplete();
if (this.customSettings.langue == "fr")
{
progress.setStatus("Complété.");
}
else
{
progress.setStatus("Complete.");
}
progress.toggleCancel(false);
document.getElementById("preview").innerHTML = "<div id='cadre-image'><input type='hidden' name='txtFichier' value='" + file.name + "'><img id='imgPreview' src='images/thumbnailVideo.php?src=" + file.name + "&save=true' /><p>" + file.name + "</p></div>";
document.getElementById("tdAjouter").innerHTML = "<input type='submit' value='Ajouter' />";
var divupload = document.getElementById("upload");
divupload.style.display = "none";
} catch (ex) {
this.debug(ex);
}
}
}