Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save georgiawang5332/fa7bfb233c05e5c98008a5f59b2d9b77 to your computer and use it in GitHub Desktop.
Save georgiawang5332/fa7bfb233c05e5c98008a5f59b2d9b77 to your computer and use it in GitHub Desktop.
//html -
var tableAdd = '';
tableAdd = '<div class="table">' +
'<div class="' + evenMonth + 'caption">' +
'<div class="centered">' +
'<span class="divYear col-12">' + nYear + '</span>' +
'<br><br>' +
'<span class="divMonth">' + nMth + '</span>月' +
'</div></div>' +
'<div class="data-content">' +
'<div class="row heading odd d-inline cartdMonth">' + nDate + '</div>' +
divRow +
'</div></div>';
return tableAdd;
//css -
.evenMonth {
background-color: rgb(102, 116, 77) !important;
width: 100% !important;
}
//js -
//日期需要用顏色區分(當初放到迴圈部分產生六七月同時上色)
var monthColor = parseInt($(".divMonth").val());
monthColor = parseInt(monthColor / 10);
for (i = 1; i <= 12; i++) {
console.log("數字:" + i);
if ((i % 2) == 0) {
console.log(" 偶數");
} else {
console.log(" 奇數");
}
}
console.log($(".divMonth"));
//=========================================================================================================================
console.log($(".divMonth")); ------------>
數字:1
excel.js:46 奇數
excel.js:42 數字:2
excel.js:44 偶數
excel.js:42 數字:3
excel.js:46 奇數
excel.js:42 數字:4
excel.js:44 偶數
excel.js:42 數字:5
excel.js:46 奇數
excel.js:42 數字:6
excel.js:44 偶數
excel.js:42 數字:7
excel.js:46 奇數
excel.js:42 數字:8
excel.js:44 偶數
excel.js:42 數字:9
excel.js:46 奇數
excel.js:42 數字:10
excel.js:44 偶數
excel.js:42 數字:11
excel.js:46 奇數
excel.js:42 數字:12
excel.js:44 偶數
//=========================================================================================================================
or
//function GetOneMonthTable(nYear, nMth) { //當初已經產生function了,所以要寫下條件式話,就需要拿nMth直接判斷
//日期需要用顏色區分(當初放到迴圈部分產生六七月同時上色)
if ((nMth % 2) == 0) {
// console.log(" 偶數");
var evenMonth = "evenMonth ";
} else {
// console.log(" 奇數");
var evenMonth = "";
}
//=========================================================================================================================
// console.log(" 奇數"); -------------> 5月份=>基數 / 6月份=>偶數 / 7月份=>基數
//=========================================================================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment