Javascript 在NPObject上调用方法时出错!
对不起我的英语 我将uploadify更新为最新版本(uploadify-v2.1.4),这中断了我的uploadify: 我不能上传任何东西。当我试图调用“错误调用NPObject上的方法!”时,FireBug控制台返回此错误 我做错了什么 这是我的密码: 谢谢 丹尼尔。/*原始代码*/ uploadifyCancel:函数(ID){ /*新代码*/Javascript 在NPObject上调用方法时出错!,javascript,jquery,flash,uploadify,Javascript,Jquery,Flash,Uploadify,对不起我的英语 我将uploadify更新为最新版本(uploadify-v2.1.4),这中断了我的uploadify: 我不能上传任何东西。当我试图调用“错误调用NPObject上的方法!”时,FireBug控制台返回此错误 我做错了什么 这是我的密码: 谢谢 丹尼尔。/*原始代码*/ uploadifyCancel:函数(ID){ /*新代码*/ uploadifyCancel:function(ID){ jQuery(this).each(functi
uploadifyCancel:function(ID){
jQuery(this).each(function(){
document.getElementById(jQuery(this).attr("id")+"Uploader").cancelFileUpload(ID,true,false)
});
},
/*原始代码*/
jQuery(this).bind("uploadifyComplete", {
'action': settings.onComplete
}, function(event, ID, fileObj, response, data) {
if (event.data.action(event, ID, fileObj, unescape(response), data) !== false) {
jQuery("#" + jQuery(this).attr('id') + ID).find('.percentage').text(' - Completed');
if (settings.removeCompleted) {
jQuery("#" + jQuery(event.target).attr('id') + ID).fadeOut(250,function() {
jQuery(this).remove()
});
}
jQuery("#" + jQuery(event.target).attr('id') + ID).addClass('completed');
}
});
/*新代码*/
uploadifyCancel:function(ID){
jQuery(this).each(function(){
document.getElementById(jQuery(this).attr("id")+"Uploader").cancelFileUpload(ID,true,false)
});
},
jQuery(this).bind(“uploadifyProgress”{
你为什么要用document.getElementById当你使用jquery的时候???@B T:我不明白你想说什么。你能详细解释一下吗?@BT我有点晚了,但是Sommath使用了
getElementById
,因为Uploadify jquery插件使用它。他只是复制、粘贴和修改一些代码(不是全部)。
'action': settings.onProgress,
'toDisplay': settings.displayData
}, function(event, ID, fileObj, data) {
if (event.data.action(event, ID, fileObj, data) !== false) {
jQuery("#" + jQuery(this).attr('id') + ID + "ProgressBar").animate({
'width': data.percentage + '%'
},250,function() {
if (data.percentage == 100) {
jQuery(this).closest('.uploadifyProgress').fadeOut(250,function() {
jQuery(this).remove()
});
}
});
if (event.data.toDisplay == 'percentage') displayData = ' - ' + data.percentage + '%';
if (event.data.toDisplay == 'speed') displayData = ' - ' + data.speed + 'KB/s';
if (event.data.toDisplay == null) displayData = ' ';
jQuery("#" + jQuery(this).attr('id') + ID).find('.percentage').text(displayData);
}
});