質問編集履歴

5

修正

2022/06/21 06:13

投稿

nanashissss
nanashissss

スコア60

test CHANGED
File without changes
test CHANGED
@@ -1,8 +1,7 @@
1
1
  全ページのcopyrightの上にfooter用のナビゲーションを追加したいです。
2
2
  全ページに入れたいのですが、Object.keysでキーと値をlistのliタグ内で展開したいのですがPHPのように組み込みがうまくいかなく。
3
3
  レクチャー頂ければ幸いです。
4
-
4
+ ※querySelectorでcopyrightを取得してそちらの上部にHTMLを差し込みたいです
5
-
6
5
  ```ここに言語を入力
7
6
 
8
7
  var obj = {

4

修正完

2022/06/21 04:12

投稿

nanashissss
nanashissss

スコア60

test CHANGED
File without changes
test CHANGED
@@ -39,20 +39,20 @@
39
39
  PHPで恐縮ですが再現したいのは以下のような物です
40
40
 
41
41
  ```ここに言語を入力
42
- <?php
42
+ <?php
43
- $navlist = [
43
+ $navlist = [
44
- 'index' => '"テキストa',
44
+ 'index' => 'テキストa',
45
- 'index2' => '"テキストb',
45
+ 'index2' => '"テキストb',
46
- ];
46
+ ];
47
- ?>
47
+ ?>
48
- <li>
48
+ <li>
49
- <?php foreach($navlist as $key => $text):?>
49
+ <?php foreach($navlist as $key => $text):?>
50
- <li><?php echo $text ?>
51
- <a href="<?php echo $key ?>"></a>
50
+ <li><a href="<?php echo $key ?>"><?php echo $text ?>
52
-
51
+ </a>
52
+
53
- </li>
53
+ </li>
54
- <?php endforeach; ?>
54
+ <?php endforeach; ?>
55
- </li>>
55
+ </li>
56
56
  ```
57
57
 
58
58
 

3

修正完了

2022/06/21 04:08

投稿

nanashissss
nanashissss

スコア60

test CHANGED
File without changes
test CHANGED
@@ -41,9 +41,8 @@
41
41
  ```ここに言語を入力
42
42
  <?php
43
43
  $navlist = [
44
- 'テキストa' => '"localhost/index',
44
+ 'index' => '"テキストa',
45
- 'テキストb' => '"localhost/index2',
45
+ 'index2' => '"テキストb',
46
- 'テキストc' => '"localhost/index3',
47
46
  ];
48
47
  ?>
49
48
  <li>

2

修正完了

2022/06/21 03:58

投稿

nanashissss
nanashissss

スコア60

test CHANGED
File without changes
test CHANGED
@@ -41,9 +41,9 @@
41
41
  ```ここに言語を入力
42
42
  <?php
43
43
  $navlist = [
44
- テキストa:"localhost/index",
44
+ 'テキストa' => '"localhost/index',
45
- テキストb:"localhost/index2",
45
+ 'テキストb' => '"localhost/index2',
46
- テキストc:"localhost/index3",
46
+ 'テキストc' => '"localhost/index3',
47
47
  ];
48
48
  ?>
49
49
  <li>

1

修正完了

2022/06/21 03:56

投稿

nanashissss
nanashissss

スコア60

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
  ```ここに言語を入力
7
- function HtmlDoc(){
7
+
8
8
  var obj = {
9
9
  テキストa:"localhost/index",
10
10
  テキストb:"localhost/index2",
@@ -13,7 +13,7 @@
13
13
  Object.keys(obj).forEach(function(key) {
14
14
  console.log(key, obj[key]);
15
15
  });
16
- };
16
+
17
17
  console.log(HtmlDoc());
18
18
  ```
19
19
  ```ここに言語を入力