日期:2014-05-17 浏览次数:20438 次
if (DateTime.Compare(pt.EndTime, DateTime.Now) > 0)//时间对比 { //pt.EndTime就是你数据库设置的结束时间 //秒杀成功的处理代码 } { ShowMessageBox("活动已结束,请关注下次活动!"); }
------解决方案--------------------
$(document).ready(function() { //电子电器 var CountdownTImeE = $("input[id*=txtElectronCountdownTime]").val(); //倒计时 if (CountdownTImeE != "" && CountdownTImeE != null) { var year = CountdownTImeE.split(' ')[0].split('-')[0]; //年 var month = CountdownTImeE.split(' ')[0].split('-')[1]; //月 var day = CountdownTImeE.split(' ')[0].split('-')[2]; //日 var hour = CountdownTImeE.split(' ')[1].split(':')[0]; //时 var min = CountdownTImeE.split(' ')[1].split(':')[1]; //分 var second = CountdownTImeE.split(' ')[1].split(':')[2]; //秒 var time = month + "/" + day + "/" + year + " " + hour + ":" + min + ":" + second; var endtime = new Date(time); //时间格式:"7/21/2010 09:48:00" var nowtime = new Date(); var maxtime = (endtime.getTime() - nowtime.getTime()) / 1000; var timer = setInterval("daojishiE()", 1000); if (maxtime <= 0) { $(".xs-qg-qw").eq(0).show(); $(".xs-qg-qg").eq(0).hide(); $(".xs-qg-qw").eq(1).show(); $(".xs-qg-qg").eq(1).hide(); clearInterval(timer); document.getElementById('showdateElectron').innerHTML = "<i>电子电器:</i><b>剩</b><em>00< /em><b>时</b><em>00</em><b>分< /b><em>00</em><b>秒</b>"; } daojishiE = function() { if (maxtime >= 0) { //day = Math.floor(maxtime / 3600 / 24); hours = Math.floor(maxtime / 3600); minutes = Math.floor((maxtime / 60) % 60); seconds = Math.floor(maxtime % 60); msg = "<i>电子电器:</i><b>剩</b>" + "<em>" + hours + "</em>" + "<b>时</b>" + "<em>" + minutes + "</em>" + "<b>分</b>" + "<em>" + seconds + "</em>" + "<b>秒</b>"; document.getElementById('showdateElectron').innerHTML = msg; //if(maxtime == 5*60) alert('注意,还有5分钟!'); --maxtime; } else { var proid = ""; $("#divCountdown input[id='hidProidE']").each(function() { proid += $(this).val() + ","; }); $.get("/AjaxBehind/DefaultHandler.ashx", { type: "edit", proidlist: proid }, function(data) { $("#showdateElectron").html(data); clearInterval(timer); window.location = window.location; }); } } } });