Javascript 自定义jQuery横幅旋转器仅适用于FireFox
我为我拥有的横幅旋转器编写了以下jQuery代码:Javascript 自定义jQuery横幅旋转器仅适用于FireFox,javascript,jquery,internet-explorer,firefox,banner,Javascript,Jquery,Internet Explorer,Firefox,Banner,我为我拥有的横幅旋转器编写了以下jQuery代码: Featured_TopBanner: { Init: function () { var featItems $.ajax({ url: '/Auctions/Auctions.asmx/Featured_TopBanner_Items' , type: 'POST' , contentType: 'application/json; ch
Featured_TopBanner: {
Init: function () {
var featItems
$.ajax({
url: '/Auctions/Auctions.asmx/Featured_TopBanner_Items'
, type: 'POST'
, contentType: 'application/json; charset=utf-8'
, dataType: 'json'
, success: function (data) {
Auctions.Featured_TopBanner.ChangeSlide(data.d);
}
});
},
ChangeSlide: function (featItems) {
var currentIndex = $(".auction_featured_top_currentindex").html();
var newIndex = parseInt(currentIndex) + 1;
if (newIndex > (parseInt(featItems.length) - 1)) {
newIndex = 0;
}1
var featItem = featItems[newIndex];
$(".auction_featured_top").fadeOut('slow', function () {
$(".auction_featured_top_img").css("background-image", "url(/Auctions/ItemImg_TopBanner.ashx?itemid=" + featItem[0]);
$(".auction_featured_top_link").attr("href", "/Auction/" + featItem[2] + ".aspx");
$(this).fadeIn('slow');
});
$(".auction_featured_top_currentindex").html(newIndex);
setTimeout(function () {
Auctions.Featured_TopBanner.ChangeSlide(featItems);
}, 15000);
}
}
但是,此代码仅在FireFox中有效
Internet Explorer 8在jQuery javascript文件的第116行返回“无效参数”错误
值得注意的是,这只是一个代码片段,Featured\u TopBanner
属于拍卖
。还有Auctions.Featured_TopBanner.Init()代码>在页面加载时运行
干杯尝试更改此选项(为清晰起见,请将线条打断):
为此:
$(".auction_featured_top_img")
.css(
"background-image",
"url(/Auctions/ItemImg_TopBanner.ashx?itemid=" + featItem[0] + ")"
);
请注意缺少的右括号。Urgh bug,在所有这些之后,很好地发现了!谢谢你的帮助:)
$(".auction_featured_top_img")
.css(
"background-image",
"url(/Auctions/ItemImg_TopBanner.ashx?itemid=" + featItem[0] + ")"
);