www.gusucode.com > citySHOP B2C商城系统 进销存 2.0.6码程序 > upload/include/js/index.js

    /**
 * 倒计时
 */
function countdown(datestr,nowdate,showid,gid){
	//设置当前日期
	var vYear0 = nowdate.substr(0,4);
	var vMonth0 = nowdate.substr(5,2);
	var vDate0 = nowdate.substr(8,2);
	var vHour0 = nowdate.substr(11,2);
	var vMinute0 = nowdate.substr(14,2);
	var vSecond0 = nowdate.substr(17,2);
	var vYear = datestr.substr(0,4);
	var vMonth = datestr.substr(5,2);
	var vDate = datestr.substr(8,2);
	var vHour = datestr.substr(11,2);
	var vMinute = datestr.substr(14,2);
	var vSecond = datestr.substr(17,2);

	$("#"+showid).html("正在计算...");
	//设置过期日期
	var expireDate = new Date(vYear,vMonth-1,vDate,vHour,vMinute,vSecond);
	var thisTime = new Date(vYear0,vMonth0-1,vDate0,vHour0,vMinute0,vSecond0);
	var ltime = expireDate-thisTime;
	var remainTime = 0;
	var startlimit = setInterval(function(){
		ltime -= 1000;
		remainTime = ltime;
		if(ltime>0){
			var remainDay,remainHour,remainMinute,remainSecond;
			remainDay = Math.floor(remainTime/1000/3600/24);
			remainTime = remainTime - (remainDay*1000*3600*24);
			remainHour = Math.floor(remainTime/1000/3600);
			remainTime = remainTime - (remainHour*1000*3600);
			remainMinute = Math.floor(remainTime/1000/60);
			remainTime = remainTime - (remainMinute*1000*60);
			remainSecond = Math.floor(remainTime/1000); 
			remainTime = remainHour+"小时"+remainMinute+"分"+remainSecond+"秒";
			$("#"+showid).text(remainTime);
			
		}else{
			clearInterval(startlimit);
			$("#"+showid).html("正在更新折扣...");
			$.get('ajax.php',{action:'updatetime',inajax:'1',gid:gid},function(data){
				if(data == 'done'){
				    location.reload();
				}else{
				    $("#"+showid).html("已结束!");
				}
			});
			return;
		}
		
	},1000);
}
$(".cateshadow").ready(function(){
    $(".cateshadow").height($(".cateleft").height()-10);
});
$(document).ready(function(){    
    //首页图片轮换
	$('.adplay > a').mouseover(function(){
		var i = $(this).attr('alt') - 1;
		clearInterval(_h);
		_c = i;
		play();
		change(i);        
	})
	$(".middelad img").hover(function(){clearInterval(_h)}, function(){play()});
    change(0);
	play();
    //首页顶部N秒消失广告
	if($(".index_top_adv").html()!=''){
		var miao = parseInt($(".index_top_adv").attr("title"))*1000;
		$(".index_top_adv").removeAttr("title");
		setTimeout(function(){
			$(".index_top_adv").animate({height: "0"}, 1500);
		},miao);	
	}
    //最新动态滚动
    ScrollStart(".newactions",25,3000);
    //首页排行特效
	$(".tops_index li").mouseover(function(){
		$(".tops_index li.hov").removeClass("hov");
		$(this).addClass("hov");
		$(".toplist").hide();
		$(".toplist").eq($(".tops_index li").index(this)).show();
	});
})