回答編集履歴
1
連想配列を使ってなかったので修正
answer
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
```php
|
2
2
|
<?php
|
3
|
+
$incr = array(
|
4
|
+
'target' => 'months',
|
5
|
+
'initmodel' => '<tr>
|
6
|
+
<th>月</th>
|
7
|
+
<th>旧歴の月名</th>
|
8
|
+
</tr>'
|
9
|
+
);
|
3
10
|
|
4
11
|
$months = array(
|
5
12
|
'睦月',
|
@@ -12,15 +19,12 @@
|
|
12
19
|
|
13
20
|
?>
|
14
21
|
|
15
|
-
<table id="
|
22
|
+
<table id="<?php echo $incr['target']; ?>">
|
16
|
-
<tr>
|
17
|
-
<th>月</th>
|
18
|
-
|
23
|
+
<?php echo $incr['initmodel']; ?>
|
19
|
-
</tr>
|
20
24
|
</table>
|
21
25
|
|
22
26
|
<script>
|
23
|
-
const monthTable = document.getElementById('
|
27
|
+
const monthTable = document.getElementById('<?php echo $incr['target']; ?>');
|
24
28
|
const insertFunc = (index, month) => {
|
25
29
|
const row = monthTable.insertRow();
|
26
30
|
row.insertCell().textContent = `${index + 1}月`;
|