美好的一天
我在我的网页上使用淘汰赛。现在我有一个删除/暂停卡功能,用户可以删除一个条目,敲出弹出窗口,并要求用户确认删除他的条目/卡。
问题出在IE8上,当点击'remove'时,会显示弹出窗口,但是方向偏离位置并且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
我该如何解决这个问题?
以下是我网页上的Knockout代码:
<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 :(得分:0)
试试这个:
options.theme.style
以下是一些可以帮助您的网址: