回答編集履歴
1
sample
test
CHANGED
@@ -3,3 +3,57 @@
|
|
3
3
|
年と月がきまれば
|
4
4
|
|
5
5
|
new Date("2020-06-02")のような渡し方をすればその月のデータになるでしょう
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
```javascript
|
10
|
+
|
11
|
+
<script>
|
12
|
+
|
13
|
+
window.addEventListener('DOMContentLoaded', ()=>{
|
14
|
+
|
15
|
+
const y=document.querySelector('#id_year');
|
16
|
+
|
17
|
+
const m=document.querySelector('#id_month');
|
18
|
+
|
19
|
+
const v=document.querySelector('#view');
|
20
|
+
|
21
|
+
document.querySelector('#chk').addEventListener('click',()=>{
|
22
|
+
|
23
|
+
v.textContent=new Date(`${y.value}-${m.value}-01`);
|
24
|
+
|
25
|
+
});
|
26
|
+
|
27
|
+
});
|
28
|
+
|
29
|
+
</script>
|
30
|
+
|
31
|
+
<select class="cl_year" id="id_year">
|
32
|
+
|
33
|
+
<option value="2021">2021</option>
|
34
|
+
|
35
|
+
<option value="2020">2020</option>
|
36
|
+
|
37
|
+
<option value="2019">2019</option>
|
38
|
+
|
39
|
+
</select>
|
40
|
+
|
41
|
+
年
|
42
|
+
|
43
|
+
<select class="cl_month" id="id_month">
|
44
|
+
|
45
|
+
<option value="01">1</option>
|
46
|
+
|
47
|
+
<option value="02">2</option>
|
48
|
+
|
49
|
+
<option value="03">3</option>
|
50
|
+
|
51
|
+
</select>
|
52
|
+
|
53
|
+
月
|
54
|
+
|
55
|
+
<input type="button" value="check" id="chk">
|
56
|
+
|
57
|
+
<div id="view"></div>
|
58
|
+
|
59
|
+
```
|