簡短的生成當月簽到日曆

2021-08-20 01:18:51 字數 999 閱讀 8757

解決方法:

1.參考:原大神的日曆簽到:emmmm,找不到了,不過基本是在www.jq22.com上找到。

2.自製:

效果圖:

優點:大小隨父元素大小變化,樣式及內容可以隨意修改,**簡單容易修改當然功能也就簡單的。

缺點:功能單一,只是展示當月,以及簽到的日期

使用:

var thearr =[0,13,1]

getcalendar(thearr);

html部分:

js部分(需要jquery或者zepto):

/**

* 自製簽到日曆

* setcalendar為基礎值配置

* getcalendar為渲染日曆方法,渲染到 #calendar .thecalendar這個元素中,

* 並且月份渲染到#calendar .thetitle這個元素中;

* * 對於簽到的資料渲染採用:getcalendar([1,5,20])的渲染方式

* 若無簽到資料,則直接getcalendar([0])

* * */

var setcalendar =

function getcalendar(arr)

#calendarlist .thetitle

#calendarlist li

#calendarlist ul

#calendarlist li

#calendarlist .thecalendar

#calendarlist .thecalendar ul

#calendarlist .thecalendar li

#calendarlist .cal_active

js生成當月日曆

var date new date 當前是哪一年 var year date getfullyear 當前是哪個月,注意這裡的月是從0開始計數的 var month date getmonth 當前月的第一天的日期 var firstday newdate year,month,1 第一天是星期幾 ...

輸出當月的日曆

專案中碰到乙個需要手動輸入月份,然後頁面輸出當月日曆的功能,開始想用js來做,發現沒辦法做。之後,因為還需要設定每個日期的節假日,想到之前做過萬年曆。剛好用上了,就通過程式演算法來控制,無論選擇那個月,都能顯示日曆。程式碼如下 string strdate webutils.getparameter...

JS獲取當月windows顯示的日曆 簡易版本

js 要求格式yyyy mm param currentmonth 當前月份 function getcalendar currentmonth var calendar var mydate currentmonth.split 1 1 computedate currentmonth forea...