基本信息
源码名称:jQuery每日签到功能日历代码
源码大小:0.03M
文件格式:.zip
开发语言:CSS
更新时间:2017-12-08
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jQuery每日签到功能日历代码</title>
<script type="text/javascript" src="js/jquery-1.8.3.min.js" ></script>
<style type="text/css">
*{margin: 0; padding: 0;}
.home{ width: 700px; margin: auto; background: #008573;}
.home thead>tr>td{ width: 100px; height: 40px; text-align: center; color: #fff;}
.home tbody>tr>td{ width: 100px; height: 100px; margin: 1px; background: #ececec; text-align: center;}
.float{ float: left;}
#button,#button2{ width: 300px;height: 80px; font-size: 50px;}
#button2{ margin-left: 100px;}
.color{ color: red; font-size: 30px;}
.los{ color: #008573;font-size: 30px;}
.weiqian{color: #03A9F4; font-size: 30px;}
</style>
</head>
<body><script src="/demos/googlegg.js"></script>
<div class="home">
<table cellspacing="1" cellpadding="1" >
<thead id="thead">
<tr>
<td>日</td>
<td>一</td>
<td>二</td>
<td>三</td>
<td>四</td>
<td>五</td>
<td>六</td>
</tr>
</thead>
<tbody id="tbody"></tbody>
</table>
<button id="button" class="float">签到</button>
<button id="button2" class="float">本月已签</button>
</div>
<script type="text/javascript">
$(function(){
var sliarrn=[15,17,16,18]
var $thead=$('#thead'),
$tbody=$('#tbody'),
$button=$('#button'),
$button2=$('#button2'),
wk=true,
slidate=new Date(),
_nullnei='',
de=slidate.getDate() 1;
var monthFirst = new Date(slidate.getFullYear(), parseInt(slidate.getMonth()), 1).getDay();//获取当月的1日等于星期几
var d = new Date(slidate.getFullYear(), parseInt(slidate.getMonth() 1), 0); //获取月
var conter=d.getDate();//获取当前月的天数
//遍历日历网格
for(var i=1; i<=6;i ){
_nullnei ="<tr>";
for(var j=1; j<=7;j )
{
_nullnei ='<td></td>';
}
_nullnei ="</tr>";
}
$tbody.html(_nullnei);
//遍历网格内容
var $slitd=$tbody.find("td");
for(var i=0; i<conter; i )
{
$slitd.eq(i monthFirst).html("<p>" parseInt(i 1) "</p>")
}
Funback();//给当前日加样式
Funmore();//本月未签到样式
Funmonth();//查询已签到
$button.on("click",function(){
if(wk==true)
{
sliarrn.push(de-1);//把当日传入已签
Funmonth(); //再次查询签到
alert('已签到');
}
})
$button2.on("click",function(){
alert('你本月已签到' sliarrn.length '次')
})
function Funback(){
$slitd.eq(parseInt(de)).addClass('color')
}
function Funmore(){
for(var i=0; i<de; i )
{
$slitd.eq(i).addClass('weiqian')
}
}
function Funmonth(){
for(var i=0; i<conter; i )
{
for(var j=0; j<sliarrn.length;j )
{
if(i==sliarrn[j])
{
$slitd.eq(i 1).addClass('los')
}
}
}
}
})
</script>
</body>
</html>