質問編集履歴
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -106,6 +106,10 @@
|
|
106
106
|
|
107
107
|
li_element.appendChild(aGoogle_element);
|
108
108
|
|
109
|
+
li_element.appendChild(aYahoo_element);
|
110
|
+
|
111
|
+
li_element.appendChild(aBing_element);
|
112
|
+
|
109
113
|
|
110
114
|
|
111
115
|
</script>
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -53,3 +53,69 @@
|
|
53
53
|
</body>
|
54
54
|
|
55
55
|
```
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
## 編集後
|
60
|
+
|
61
|
+
```javascript
|
62
|
+
|
63
|
+
<body>
|
64
|
+
|
65
|
+
<h1>課題1</h1>
|
66
|
+
|
67
|
+
<div id="box"></div>
|
68
|
+
|
69
|
+
<script>
|
70
|
+
|
71
|
+
let ul_element = document.createElement('ul');
|
72
|
+
|
73
|
+
let li_element = document.createElement('li');
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
let aGoogle_element = document.createElement('a');
|
78
|
+
|
79
|
+
aGoogle_element.innerHTML = 'google';
|
80
|
+
|
81
|
+
aGoogle_element.href = 'https://google.com';
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
let aYahoo_element = document.createElement('a');
|
86
|
+
|
87
|
+
aYahoo_element.innerHTML = 'Yahoo';
|
88
|
+
|
89
|
+
aYahoo_element.href = 'https://yahoo.com';
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
let aBing_element = document.createElement('a');
|
94
|
+
|
95
|
+
aBing_element.innerHTML = 'Bing';
|
96
|
+
|
97
|
+
aBing_element.href = 'https://bing.com';
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
let box_element = document.getElementById('box');
|
102
|
+
|
103
|
+
box_element.appendChild(ul_element);
|
104
|
+
|
105
|
+
ul_element.appendChild(li_element);
|
106
|
+
|
107
|
+
li_element.appendChild(aGoogle_element);
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
</script>
|
112
|
+
|
113
|
+
</body>
|
114
|
+
|
115
|
+
```
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
for文で3つまで増やそうとしたところリンクが3つ並んだものが3つになるという始末です。
|
120
|
+
|
121
|
+
for(let i = 1; i <= 5; i++){
|