Jquery 延长批次后的拍卖计时器问题
我在asp.net的拍卖网站上工作。当我们点击每个批次的递增出价按钮时,如果计时器中的时间小于3分钟,则批次时间将延长3分钟,但每个批次的计时器将不匹配几秒钟,我的客户不希望这样 这是调用JS函数来扩展批次的计时:Jquery 延长批次后的拍卖计时器问题,jquery,asp.net,timer,Jquery,Asp.net,Timer,我在asp.net的拍卖网站上工作。当我们点击每个批次的递增出价按钮时,如果计时器中的时间小于3分钟,则批次时间将延长3分钟,但每个批次的计时器将不匹配几秒钟,我的客户不希望这样 这是调用JS函数来扩展批次的计时: eval('timer' + auctionLotId).cdtime('timer' + auctionLotId + "', '" + auctioncurrtime + "', '" + auctionendtimer + "', " + auctionLotId);
eval('timer' + auctionLotId).cdtime('timer' + auctionLotId + "', '" + auctioncurrtime + "', '" + auctionendtimer + "', " + auctionLotId);
这是用于更新计时器的JS文件:
function cdtime(container, currentTime, targetdate, AuctionLotID) {
if (!document.getElementById || !document.getElementById(container))
return;
this.container = document.getElementById(container);
this.auctionLotID = AuctionLotID;
var now = new Date();
//this.currentTime = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
//this.currentTime = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
this.currentTime = new Date(currentTime);
this.targetdate = new Date(targetdate);
this.currentTime.setSeconds(this.currentTime.getSeconds() - 1);
//alert('currentTime: ' + this.currentTime);
//this.targetdate = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
this.timesup = false;
this.updateTime();
}
cdtime.prototype.resetTimer = function (newdate) {
var thisobj = this;
this.targetdate = new Date(newdate);
this.extended = 1;
this.timesup = false;
//this.updateTime();
}
cdtime.prototype.updateTime = function () {
//alert(this.currentTime);
var thisobj = this;
this.currentTime.setSeconds(this.currentTime.getSeconds() + 1);
this.tim = setTimeout(function () { thisobj.updateTime() }, 1000); //update time every second
//timer = setTimeout(updatetimer, 1000);
}
此逻辑必须在服务器端执行,否则您的站点将很容易被黑客攻击。此逻辑必须在服务器端执行,否则您的站点将很容易被黑客攻击。