本文介绍了批次扩展后的拍卖计时器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在asp.net的拍卖网站上工作。当我们点击每个批次的增量出价按钮时,如果计时器中的时间少于3分钟,那么批次时间会延长3分钟,但每个批次的计时器会在几秒钟内失配,而我的客户不希望这样。 />
这是调用JS函数来延长批次的时间:



I am working on auction site in asp.net. When we click on increment bid button of each lot , If time in timer is less than 3 minutes then lot time gets extended for 3 minutes but timers of each lot get mismatched by couple of seconds and my client don't want that.
This is calling of JS function to extend timing for lot:

eval('timer' + auctionLotId).cdtime('timer' + auctionLotId + "', '" + auctioncurrtime + "', '" + auctionendtimer + "', " + auctionLotId);







这是用于更新计时器的JS文件:




This is JS file for updating timer :

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(); //by yogesh
}
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);
}

推荐答案


这篇关于批次扩展后的拍卖计时器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 01:31