質問編集履歴
4
インデント
test
CHANGED
File without changes
|
test
CHANGED
@@ -140,45 +140,45 @@
|
|
140
140
|
|
141
141
|
select3.options[i-1] = new Option(i);
|
142
142
|
|
143
|
-
|
143
|
+
}
|
144
144
|
|
145
|
-
|
145
|
+
if(select2.options[select2.selectedIndex].value==4||select2.options[select2.selectedIndex].value==6||select2.options[select2.selectedIndex].value==9||select2.options[select2.selectedIndex].value==11){
|
146
146
|
|
147
147
|
for(i=1;i<=30;i++)
|
148
148
|
|
149
149
|
select3.options[i-1] = new Option(i);
|
150
150
|
|
151
|
-
|
151
|
+
}
|
152
152
|
|
153
|
-
|
153
|
+
else if (select2.options[select2.selectedIndex].value==2){
|
154
154
|
|
155
|
-
|
155
|
+
if((select1.options[select1.selectedIndex].value%4==0&&select1.options[select1.selectedIndex].value%100!=0)||select1.options[select1.selectedIndex].value%400==0){
|
156
156
|
|
157
|
-
|
157
|
+
for(i=1;i<=29;i++)
|
158
158
|
|
159
159
|
select3.options[i-1] = new Option(i);
|
160
160
|
|
161
|
-
|
161
|
+
}
|
162
162
|
|
163
|
-
|
163
|
+
else{
|
164
164
|
|
165
|
-
|
165
|
+
for(i=1;i<=28;i++)
|
166
166
|
|
167
|
-
|
167
|
+
select3.options[i-1] = new Option(i);
|
168
168
|
|
169
|
-
|
169
|
+
}
|
170
170
|
|
171
|
-
|
171
|
+
}
|
172
172
|
|
173
|
-
|
173
|
+
else{
|
174
174
|
|
175
|
-
|
175
|
+
for(i=1;i<=31;i++)
|
176
176
|
|
177
|
-
|
177
|
+
select3.options[i-1] = new Option(i);
|
178
178
|
|
179
|
-
|
179
|
+
}
|
180
180
|
|
181
|
-
|
181
|
+
}
|
182
182
|
|
183
183
|
</script>
|
184
184
|
|
3
補足
test
CHANGED
File without changes
|
test
CHANGED
@@ -13,6 +13,8 @@
|
|
13
13
|
(2) 閏年が考慮されていること(=2月が28日までのものと29までのものが存在)
|
14
14
|
|
15
15
|
(3) 現在までの年月日のみが選択できること(=未来は選択できないこと)
|
16
|
+
|
17
|
+
(4) 補足:送信ボタンを押した後に,自分自身に帰ってくる場合(action="index.php")に押下した値がリセットされずに残っているとなお良い
|
16
18
|
|
17
19
|
|
18
20
|
|
2
補足
test
CHANGED
File without changes
|
test
CHANGED
@@ -150,7 +150,7 @@
|
|
150
150
|
|
151
151
|
else if (select2.options[select2.selectedIndex].value==2){
|
152
152
|
|
153
|
-
if((select1.options[select1.selectedIndex].value%4==0&&select1.options[select1.selectedIndex].value%10!=0)||select1.options[select1.selectedIndex].value%400==0){
|
153
|
+
if((select1.options[select1.selectedIndex].value%4==0&&select1.options[select1.selectedIndex].value%100!=0)||select1.options[select1.selectedIndex].value%400==0){
|
154
154
|
|
155
155
|
for(i=1;i<=29;i++)
|
156
156
|
|
1
インデントを加え補足した
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,6 +28,10 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
+
イメージ的にはyear,month,dayに現在年月日を,
|
32
|
+
|
33
|
+
selectYear,selectMonth,selectDayに選択年月日を入れてプログラムを組んだつもりです.
|
34
|
+
|
31
35
|
|
32
36
|
|
33
37
|
```HTML
|
@@ -38,141 +42,141 @@
|
|
38
42
|
|
39
43
|
<body bgcolor onLoad="dateFunc()">
|
40
44
|
|
41
|
-
<img src="LOGO.png" alt="">
|
45
|
+
<img src="LOGO.png" alt="">
|
42
46
|
|
43
|
-
<h2>
|
47
|
+
<h2>見出し</h2>
|
44
48
|
|
45
|
-
<?php
|
49
|
+
<?php
|
46
50
|
|
47
|
-
date_default_timezone_set('Asia/Tokyo');
|
51
|
+
date_default_timezone_set('Asia/Tokyo');
|
48
52
|
|
49
|
-
$year=filter_input(INPUT_GET,'year')?:date('Y');
|
53
|
+
$year=filter_input(INPUT_GET,'year')?:date('Y');
|
50
54
|
|
51
|
-
$month=filter_input(INPUT_GET,'month')?:date('n');
|
55
|
+
$month=filter_input(INPUT_GET,'month')?:date('n');
|
52
56
|
|
53
|
-
$day=filter_input(INPUT_GET,'day')?:date('j');
|
57
|
+
$day=filter_input(INPUT_GET,'day')?:date('j');
|
54
58
|
|
55
|
-
?>
|
59
|
+
?>
|
56
60
|
|
57
|
-
<form name="selectDate" method="get">
|
61
|
+
<form name="selectDate" method="get">
|
58
62
|
|
59
|
-
<select name="selectYear">
|
63
|
+
<select name="selectYear">
|
60
64
|
|
61
|
-
<?php
|
65
|
+
<?php
|
62
66
|
|
63
|
-
for($i=2015;$i<=date('Y');$i++){
|
67
|
+
for($i=2015;$i<=date('Y');$i++){
|
64
68
|
|
65
|
-
$selected=$i==$year?"selected":"";
|
69
|
+
$selected=$i==$year?"selected":"";
|
66
70
|
|
67
|
-
print "<option value=\"{$i}\"{$selected}>{$i}</option>";
|
71
|
+
print "<option value=\"{$i}\"{$selected}>{$i}</option>";
|
68
72
|
|
69
|
-
}
|
73
|
+
}
|
70
74
|
|
71
|
-
?>
|
75
|
+
?>
|
72
76
|
|
73
|
-
</select> 年
|
77
|
+
</select> 年
|
74
78
|
|
75
|
-
<select name="selectMonth">
|
79
|
+
<select name="selectMonth">
|
76
80
|
|
77
|
-
</select> 月
|
81
|
+
</select> 月
|
78
82
|
|
79
|
-
<select name="selectDay">
|
83
|
+
<select name="selectDay">
|
80
84
|
|
81
|
-
</select> 日
|
85
|
+
</select> 日
|
82
86
|
|
83
87
|
|
84
88
|
|
85
|
-
<script type="text/javascript">
|
89
|
+
<script type="text/javascript">
|
86
90
|
|
87
|
-
var year='<?php echo $year; ?>';
|
91
|
+
var year='<?php echo $year; ?>';
|
88
92
|
|
89
|
-
var month='<?php echo $month; ?>';
|
93
|
+
var month='<?php echo $month; ?>';
|
90
94
|
|
91
|
-
var day='<?php echo $day; ?>';
|
95
|
+
var day='<?php echo $day; ?>';
|
92
96
|
|
93
|
-
function dateFunc(){
|
97
|
+
function dateFunc(){
|
94
98
|
|
95
|
-
var select1 = document.forms.selectDate.selectYear;
|
99
|
+
var select1 = document.forms.selectDate.selectYear;
|
96
100
|
|
97
|
-
var select2 = document.forms.selectDate.selectMonth;
|
101
|
+
var select2 = document.forms.selectDate.selectMonth;
|
98
102
|
|
99
|
-
var select3 = document.forms.selectDate.selectDay;
|
103
|
+
var select3 = document.forms.selectDate.selectDay;
|
100
104
|
|
101
105
|
|
102
106
|
|
103
|
-
select2.options.length=0;
|
107
|
+
select2.options.length=0;
|
104
108
|
|
105
|
-
select3.options.length=0;
|
109
|
+
select3.options.length=0;
|
106
110
|
|
107
111
|
|
108
112
|
|
109
|
-
if(select1.options[select1.selectedIndex].value==year){
|
113
|
+
if(select1.options[select1.selectedIndex].value==year){
|
110
114
|
|
111
|
-
for(i=1;i<=month;i++){
|
115
|
+
for(i=1;i<=month;i++){
|
112
116
|
|
113
|
-
select2.options[i-1] = new Option(i);
|
117
|
+
select2.options[i-1] = new Option(i);
|
114
118
|
|
115
|
-
}
|
119
|
+
}
|
116
120
|
|
117
|
-
}
|
121
|
+
}
|
118
122
|
|
119
|
-
else{
|
123
|
+
else{
|
120
124
|
|
121
|
-
for(i=1;i<=12;i++){
|
125
|
+
for(i=1;i<=12;i++){
|
122
126
|
|
123
|
-
select2.options[i-1] = new Option(i);
|
127
|
+
select2.options[i-1] = new Option(i);
|
124
128
|
|
125
|
-
}
|
129
|
+
}
|
126
130
|
|
127
|
-
}
|
131
|
+
}
|
128
132
|
|
129
133
|
|
130
134
|
|
131
|
-
if
|
135
|
+
if(select1.options[select1.selectedIndex].value==year||select2.options[select2.selectedIndex].value==month){
|
132
136
|
|
133
|
-
for(i=1;i<=day;i++)
|
137
|
+
for(i=1;i<=day;i++)
|
134
138
|
|
135
|
-
select3.options[i-1] = new Option(i);
|
139
|
+
select3.options[i-1] = new Option(i);
|
136
140
|
|
137
|
-
}
|
141
|
+
}
|
138
142
|
|
139
|
-
if(select2.options[select2.selectedIndex].value==4||select2.options[select2.selectedIndex].value==6||select2.options[select2.selectedIndex].value==9||select2.options[select2.selectedIndex].value==11){
|
143
|
+
if(select2.options[select2.selectedIndex].value==4||select2.options[select2.selectedIndex].value==6||select2.options[select2.selectedIndex].value==9||select2.options[select2.selectedIndex].value==11){
|
140
144
|
|
141
|
-
for(i=1;i<=30;i++)
|
145
|
+
for(i=1;i<=30;i++)
|
142
146
|
|
143
|
-
select3.options[i-1] = new Option(i);
|
147
|
+
select3.options[i-1] = new Option(i);
|
144
148
|
|
145
|
-
}
|
149
|
+
}
|
146
150
|
|
147
|
-
else if (select2.options[select2.selectedIndex].value==2){
|
151
|
+
else if (select2.options[select2.selectedIndex].value==2){
|
148
152
|
|
149
|
-
if((select1.options[select1.selectedIndex].value%4==0&&select1.options[select1.selectedIndex].value%10!=0)||select1.options[select1.selectedIndex].value%400==0){
|
153
|
+
if((select1.options[select1.selectedIndex].value%4==0&&select1.options[select1.selectedIndex].value%10!=0)||select1.options[select1.selectedIndex].value%400==0){
|
150
154
|
|
151
|
-
for(i=1;i<=29;i++)
|
155
|
+
for(i=1;i<=29;i++)
|
152
156
|
|
153
|
-
select3.options[i-1] = new Option(i);
|
157
|
+
select3.options[i-1] = new Option(i);
|
154
158
|
|
155
|
-
}
|
159
|
+
}
|
156
160
|
|
157
|
-
else{
|
161
|
+
else{
|
158
162
|
|
159
|
-
for(i=1;i<=28;i++)
|
163
|
+
for(i=1;i<=28;i++)
|
160
164
|
|
161
|
-
select3.options[i-1] = new Option(i);
|
165
|
+
select3.options[i-1] = new Option(i);
|
162
166
|
|
163
|
-
}
|
167
|
+
}
|
164
168
|
|
165
|
-
}
|
169
|
+
}
|
166
170
|
|
167
|
-
else{
|
171
|
+
else{
|
168
172
|
|
169
|
-
for(i=1;i<=31;i++)
|
173
|
+
for(i=1;i<=31;i++)
|
170
174
|
|
171
|
-
select3.options[i-1] = new Option(i);
|
175
|
+
select3.options[i-1] = new Option(i);
|
172
176
|
|
173
|
-
}
|
177
|
+
}
|
174
178
|
|
175
|
-
}
|
179
|
+
}
|
176
180
|
|
177
181
|
</script>
|
178
182
|
|