回答編集履歴

1

連想配列を使ってなかったので修正

2020/07/02 03:54

投稿

miyabi_pudding
miyabi_pudding

スコア9528

test CHANGED
@@ -1,6 +1,20 @@
1
1
  ```php
2
2
 
3
3
  <?php
4
+
5
+ $incr = array(
6
+
7
+ 'target' => 'months',
8
+
9
+ 'initmodel' => '<tr>
10
+
11
+ <th>月</th>
12
+
13
+ <th>旧歴の月名</th>
14
+
15
+ </tr>'
16
+
17
+ );
4
18
 
5
19
 
6
20
 
@@ -26,15 +40,9 @@
26
40
 
27
41
 
28
42
 
29
- <table id="months">
43
+ <table id="<?php echo $incr['target']; ?>">
30
44
 
31
- <tr>
32
-
33
- <th>月</th>
34
-
35
- <th>旧歴の月名</th>
45
+ <?php echo $incr['initmodel']; ?>
36
-
37
- </tr>
38
46
 
39
47
  </table>
40
48
 
@@ -42,7 +50,7 @@
42
50
 
43
51
  <script>
44
52
 
45
- const monthTable = document.getElementById('months');
53
+ const monthTable = document.getElementById('<?php echo $incr['target']; ?>');
46
54
 
47
55
  const insertFunc = (index, month) => {
48
56