質問編集履歴
2
文法修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -5,51 +5,3 @@
|
|
5
5
|
例えば4月31日だと表示させないようにしたいです。
|
6
6
|
|
7
7
|
あと、うるう年も考慮して書きたいです。
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
```javascript
|
12
|
-
|
13
|
-
function showUserWeekDay() {
|
14
|
-
|
15
|
-
var inputYear = document.getElementById("userYear").value;
|
16
|
-
|
17
|
-
var inputMonth = document.getElementById("userMonth").value;
|
18
|
-
|
19
|
-
var inputDate = document.getElementById("userDate").value;
|
20
|
-
|
21
|
-
var WeekChars = [ "日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日" ];
|
22
|
-
|
23
|
-
var answer = document.getElementById("answer");
|
24
|
-
|
25
|
-
var weekDate = new Date( inputYear, inputMonth - 1, inputDate );
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
if(inputYear === "" || inputMonth === "" || inputDate === ""){
|
32
|
-
|
33
|
-
answer.innerHTML = "";
|
34
|
-
|
35
|
-
} else if(inputYear.replace(/^19[0-9]{2}$|^20[0-9]{2}$/,"x") !== "x"){
|
36
|
-
|
37
|
-
answer.innerHTML = "";
|
38
|
-
|
39
|
-
} else if(inputMonth.replace(/^[1-9]$|^1[0-2]$/,"x") !== "x"){
|
40
|
-
|
41
|
-
answer.innerHTML = "";
|
42
|
-
|
43
|
-
} else if(inputDate.replace(/^[1-9]$|^1[0-9]$|^2[0-9]$|^3[0-1]$/,"x") !== "x") {
|
44
|
-
|
45
|
-
answer.innerHTML = "";
|
46
|
-
|
47
|
-
}else{
|
48
|
-
|
49
|
-
answer.innerHTML = ("結果:" + WeekChars[weekDate.getDay()] + "です。");
|
50
|
-
|
51
|
-
}
|
52
|
-
|
53
|
-
}
|
54
|
-
|
55
|
-
```
|
1
文法の修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
JavaScript
|
1
|
+
JavaScript 月毎 日付 指定 検索
|
test
CHANGED
File without changes
|