2013-03-07 46 views
0

美好的一天IE8给淘汰赛的jQuery问题 - 找不到样式

我在我的网页上使用淘汰赛。现在我有一个删除/挂起卡功能,用户可以删除一个条目并出现一个删除弹出窗口,并要求用户确认删除他的条目/卡。

问题是与IE8,在“删除”,在弹出的显示器,但这样的出位置点击,当IE给出了一个调试错误: 这是错误的详细信息:

self.options.theme.style.apply(self); (line in code with the issue) 

SCRIPT1010: Expected identifier 
default.js, line 3 character 16 
LOG: test4 
LOG: 68 
SCRIPT5007: Unable to get value of the property 'style': object is null or undefined 
jquery.noty.js, line 88 character 4 
SCRIPT5007: Unable to get value of the property 'style': object is null or undefined 
jquery.noty.js, line 88 character 4 

哪有我补救这个?

这里是我的网页上的淘汰赛代码:

<script type="text/javascript"> 
     var w = $('#cardsAdded table').innerWidth(); 
     $('#totalCost').css('width', w); 

     function DisplayConfirmNoty(message, buttons) { 
      var n = noty({ 
       text: message, 
       type: 'confirm', 
       dismissQueue: true, 
       layout: 'center', 
       theme: 'default', 
       buttons: buttons 
      }); 
     } 

     var vm = { 
      Data: ko.observable(), 
      BankAccount: ko.observable(), 

      //bankactive: ko.observable(false), 

      Suspend: function (card) { 
       console.log(card.CardId()); 

       var d = { 
        cardId: card.CardId() 
       } 

       DisplayConfirmNoty("Please note this action is irreversible trough Card Vault and you will have to contact card vendors personally to reactivate suspended cards", [ 
        { 
         addClass: 'btn btn-primary', text: 'Cancel', onClick: function ($noty) { 
          $noty.close(); 
         } 
        }, 
        { 
         addClass: 'btn btn-danger', text: 'Suspend', onClick: function ($noty) { 
          var options = 
         { 
          url: "SuspendCards.aspx/SuspendCard", 
          type: "POST", 
          contentType: "application/json", 
          data: JSON.stringify(d), 

          success: function (response) { 
           window.location = "ConfirmedSuspension.aspx"; 
          } 
         } 

          $.ajax(options); 
          $noty.close(); 
         } 
        } 
       ]); 


      }, 

      SuspendAll: function() { 

       DisplayConfirmNoty("Please note this action is irreversible trough Card Vault and you will have to contact card vendors personally to reactivate suspended cards", [ 

        { 
         addClass: 'btn btn-primary', text: 'Cancel', onClick: function ($noty) { 
          $noty.close(); 
         } 
        }, 
        { 
        addClass: 'btn btn-danger', text: 'Suspend All', onClick: function ($noty) { 
         var options = 
       { 
        url: "MyAccount.aspx/SuspendAllCards", 
        type: "POST", 
        contentType: "application/json", 

        success: function (response) { 
         window.location = "ConfirmedSuspension.aspx"; 
        } 
       } 

         $.ajax(options); 
         $noty.close(); 
        } 
       }, 

       ]); 


      }, 

      Remove: function (card) { 
       console.log(card.CardId()); 

       var d = { 
        cardId: card.CardId() 
       } 

       DisplayConfirmNoty("Are you sure you want to remove this card?", [ 
        { 
         addClass: 'btn btn-primary', text: 'Cancel', onClick: function ($noty) { 
          $noty.close(); 
         } 
        }, 
        { 
        addClass: 'btn btn-danger', text: 'Remove', onClick: function ($noty) { 

         var options = 
         { 
          url: "MyAccount.aspx/DeleteCard", 
          type: "POST", 
          contentType: "application/json", 
          data: JSON.stringify(d), 

          success: function (response) { 
           window.location = window.location; 
          } 
         } 

         $.ajax(options); 
         $noty.close(); 
        } 
       } 
       ]); 

      } 

     } 

     var cardsBound = false; 
      var accountBound = false; 

     $(document).ready(function() { 
      LoadAccount(); 
      LoadCards(); 
      // $("#") 
     }); 

     function LoadCards() { 
      var options = 
      { 
       url: "MyAccount.aspx/GetCardTypes", 
       type: "POST", 
       contentType: "application/json", 

       success: function (response) { 

        vm.Data(ko.utils.unwrapObservable(ko.mapping.fromJS(response.d))); 

        if (!cardsBound) 
          ko.applyBindings(vm, document.getElementById("cardsAdded")); 
        cardsBound = true; 
       } 
      } 
      $.ajax(options); 
     } 

     function LoadAccount() { 
      var options = 
      { 
       url: "MyAccount.aspx/GetAccount", 
       type: "POST", 
       contentType: "application/json", 

       success: function (response) { 

        vm.BankAccount(ko.utils.unwrapObservable(ko.mapping.fromJS(response.d))); 

        if (!accountBound) 
         ko.applyBindings(vm, document.getElementById("vmBankAccount")); 
        accountBound = true; 



        console.log(vm.BankAccount()[0].AccountName()); 
        //if (vm.BankAccount.length > 0) 
        // vm.bankactive(true); 
       } 
      } 
      $.ajax(options); 
     } 

    </script> 

谢谢

+0

这就是代码加载 - 你可以把它修剪到只有基本的HTML/JS这将导致该问题,并把它添加到的jsfiddle什么? – MarcoK 2013-03-07 10:26:34

+0

是的,我会看看我能做些什么。我不认为jquery淘汰赛是必要的,我只是将它包括在内以防万一需要。问题是我给的第一块代码 - 在IE8中的错误...为什么只有IE8有问题从淘汰赛js文件中读取数据? – DextrousDave 2013-03-07 10:32:13

回答

0

试试这个:

options.theme.style 

这里有一些网址,它可以帮助你:

  1. https://github.com/needim/noty/pull/
  2. https://github.com/needim/noty/pull/61
+0

谢谢。不知道你要我把代码放在上面 – DextrousDave 2013-03-07 11:15:42

+0

找到这个'self.options.theme.style.apply(self);'然后改变。 – 2013-03-07 11:16:35

+0

to - > options.theme.style?它不会在其他浏览器中崩溃吗?将尝试看看 – DextrousDave 2013-03-07 12:49:15