标签:
$(window).load(function(){
var t = setInterval(function(){
var n = Date.parse(new Date())/1000;
$(".sc4 #timeout").each(function(){
var self = this;
var y = $(this).attr(‘time‘);
var m = y*1+1800*1;
var d = m - n;
var s = d%60; //取余(秒)
var i = (d-s)/60; //取整(分)
if(d <= 0){
$(this).text(0);
var tnumber = $(this).attr(‘tnumber‘);
$.ajax({
url:‘/Home/Tao/timeout‘,
type:‘POST‘,
datatype:‘json‘,
data:{number:tnumber},
success:function(data){
if(data == 1){
$.dialog({content:‘time is out!‘,ok:function(){}});
$(self).parentsUntil(‘.sc4‘).css(‘background‘,‘#FACDC4‘).animate({opacity: ‘hide‘}, 1000);
setTimeout(function(){ $(self).parentsUntil(‘.sc4‘).remove();},1000);
}
}
});
}else{
$(this).text(i+"分"+s+"秒");
}
});
},1000);
});
标签:
原文地址:http://www.cnblogs.com/isungge/p/4701561.html