2011-07-15 36 views
2

对不起我的英文 我更新了我的uploadify到最近的版本(Uploadify-v2.1.4),并破坏了我的uploadify: 我无法上传任何内容。当我试图调用“NPObject上的错误调用方法!”时,FireBug控制台返回这个错误。在NPObject上调用方法时出错!

我在做什么错?

这里是我的代码: http://pastebin.com/bHeYHxHw

感谢,

丹尼尔。

回答

1

/*原始代码*/ uploadifyCancel:功能(ID){

     jQuery(this).each(function() { 



          document.getElementById(jQuery(this).attr('id') + 'Uploader').cancelFileUpload(ID, true, true, false); 

         }); 

        }, 

/*新代码*/

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'); 

           } 

          }); 

/*新代码*/

jQuery的(本).bind( “uploadifyProgress”,{

    '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); 

        } 

       }); 
+0

在神的名字你为什么要当你使用jQuery使用的document.getElementById ???? –

+0

@B T:我不明白你想说什么。你能否详细说明一下? –

+0

@BT我有点晚了,但Sommath使用'getElementById',因为Uploadify JQuery插件使用它。他只是复制,粘贴和修改一些代码(并非全部)。 –

相关问题