回答編集履歴
1
修正・年月取得版追加
test
CHANGED
@@ -37,3 +37,49 @@
|
|
37
37
|
<td data-date="2019-01-31">
|
38
38
|
|
39
39
|
```
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
-- 18:15 修正・年月取得版追加
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
```JavaScript
|
48
|
+
|
49
|
+
document.querySelector('#calendar').addEventListener('click', event => {
|
50
|
+
|
51
|
+
const target = event.target;
|
52
|
+
|
53
|
+
if (target.nodeName.toLowerCase() !== 'td') {
|
54
|
+
|
55
|
+
return true;
|
56
|
+
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
if (!(target.closest('tbody') && 1 <= target.cellIndex && target.cellIndex <= 7)) {
|
62
|
+
|
63
|
+
return true;
|
64
|
+
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
const time = target.parentNode.cells[0].textContent;
|
70
|
+
|
71
|
+
const table = target.closest('table');
|
72
|
+
|
73
|
+
const date = table.tHead.rows[1].cells[target.cellIndex - 1].textContent;
|
74
|
+
|
75
|
+
const ymrow = table.tHead.rows[0];
|
76
|
+
|
77
|
+
const ym = (target.cellIndex <= ymrow.cells[1].colSpan ? ymrow.cells[1] : ymrow.cells[2]).textContent;
|
78
|
+
|
79
|
+
document.getElementById('acdn-target').value = ym + date + time;
|
80
|
+
|
81
|
+
return true;
|
82
|
+
|
83
|
+
}, false);
|
84
|
+
|
85
|
+
```
|