質問編集履歴
1
情報の変更させて頂きました!説明して頂きありがとう御座いました!
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,10 +16,166 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
-
```javascript
|
20
|
-
|
21
19
|
ソースコード
|
22
20
|
|
21
|
+
```<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
22
|
+
|
23
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
24
|
+
|
25
|
+
<head>
|
26
|
+
|
27
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
28
|
+
|
29
|
+
<title>Individuell uppgift 2 - Tabellhantering och beräkning</title>
|
30
|
+
|
31
|
+
<link rel="stylesheet" type="text/css" href="style/bootstrap.min.css"/>
|
32
|
+
|
33
|
+
<link rel="stylesheet" type="text/css" href="style/style.css"/>
|
34
|
+
|
35
|
+
</head>
|
36
|
+
|
37
|
+
<body>
|
38
|
+
|
39
|
+
<div class="container">
|
40
|
+
|
41
|
+
<div id="header" class="text-center px-3 py-3 pt-md-5 pb-md-4 mx-auto">
|
42
|
+
|
43
|
+
<h1 class="display-4">Hemelektronik</h1>
|
44
|
+
|
45
|
+
<p class="lead">Se våra utmärkta priser på hemelektronik i tabellen nedan</p>
|
46
|
+
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<div id ="content">
|
50
|
+
|
51
|
+
<table id="pricetable" class="table table-hover">
|
52
|
+
|
53
|
+
<thead class="thead-dark">
|
54
|
+
|
55
|
+
<tr>
|
56
|
+
|
57
|
+
<th>Artikelnr</th>
|
58
|
+
|
59
|
+
<th>Produkttyp</th>
|
60
|
+
|
61
|
+
<th>Varumärke</th>
|
62
|
+
|
63
|
+
<th>Pris</th>
|
64
|
+
|
65
|
+
<th>Antal</th>
|
66
|
+
|
67
|
+
</tr>
|
68
|
+
|
69
|
+
</thead>
|
70
|
+
|
71
|
+
<tbody>
|
72
|
+
|
73
|
+
<tr>
|
74
|
+
|
75
|
+
<td>23456789</td>
|
76
|
+
|
77
|
+
<td>Telefon</td>
|
78
|
+
|
79
|
+
<td>Apple</td>
|
80
|
+
|
81
|
+
<td>6500</td>
|
82
|
+
|
83
|
+
<td><input type="text" size ="3" value ="1"/></td>
|
84
|
+
|
85
|
+
</tr>
|
86
|
+
|
87
|
+
<tr>
|
88
|
+
|
89
|
+
<td>22256289</td>
|
90
|
+
|
91
|
+
<td>Telefon</td>
|
92
|
+
|
93
|
+
<td>Samsung</td>
|
94
|
+
|
95
|
+
<td>6200</td>
|
96
|
+
|
97
|
+
<td><input type="text" size ="3" value ="1"/></td>
|
98
|
+
|
99
|
+
</tr>
|
100
|
+
|
101
|
+
<tr>
|
102
|
+
|
103
|
+
<td>24444343</td>
|
104
|
+
|
105
|
+
<td>Telefon</td>
|
106
|
+
|
107
|
+
<td>Huawei</td>
|
108
|
+
|
109
|
+
<td>4200</td>
|
110
|
+
|
111
|
+
<td><input type="text" size ="3" value ="1"/></td>
|
112
|
+
|
113
|
+
</tr>
|
114
|
+
|
115
|
+
<tr>
|
116
|
+
|
117
|
+
<td>19856639</td>
|
118
|
+
|
119
|
+
<td>Surfplatta</td>
|
120
|
+
|
121
|
+
<td>Apple</td>
|
122
|
+
|
123
|
+
<td>4000</td>
|
124
|
+
|
125
|
+
<td><input type="text" size ="3" value ="1"/></td>
|
126
|
+
|
127
|
+
</tr>
|
128
|
+
|
129
|
+
<tr>
|
130
|
+
|
131
|
+
<td>39856639</td>
|
132
|
+
|
133
|
+
<td>Surfplatta</td>
|
134
|
+
|
135
|
+
<td>Samsung</td>
|
136
|
+
|
137
|
+
<td>2800</td>
|
138
|
+
|
139
|
+
<td><input type="text" size ="3" value ="1"/></td>
|
140
|
+
|
141
|
+
</tr>
|
142
|
+
|
143
|
+
<tr>
|
144
|
+
|
145
|
+
<td>12349862</td>
|
146
|
+
|
147
|
+
<td>Surfplatta</td>
|
148
|
+
|
149
|
+
<td>Huawei</td>
|
150
|
+
|
151
|
+
<td>3500</td>
|
152
|
+
|
153
|
+
<td><input type="text" size ="3" value ="1"/></td>
|
154
|
+
|
155
|
+
</tr>
|
156
|
+
|
157
|
+
</tbody>
|
158
|
+
|
159
|
+
</table>
|
160
|
+
|
161
|
+
</div>
|
162
|
+
|
163
|
+
</div>
|
164
|
+
|
165
|
+
<script type="text/javascript" charset="utf-8" src="scripts/calculate.js"></script>
|
166
|
+
|
167
|
+
</body>
|
168
|
+
|
169
|
+
</html>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
```
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
ソースコード
|
178
|
+
|
23
179
|
```function add() {
|
24
180
|
|
25
181
|
/*テーブルヘッダー*/
|
@@ -56,6 +212,30 @@
|
|
56
212
|
|
57
213
|
|
58
214
|
|
215
|
+
/*行の追加*/
|
216
|
+
|
217
|
+
var tableBody = document.querySelector("#pricetable tbody");
|
218
|
+
|
219
|
+
var tablerader = tableBody.querySelectorAll("tr");
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
for (var i = 0; i < tablerader.length; i++) {
|
224
|
+
|
225
|
+
var nyCell = document.createElement("td");
|
226
|
+
|
227
|
+
var node = document.createTextNode("hej");
|
228
|
+
|
229
|
+
tablerader[i].appendChild(nyCell);
|
230
|
+
|
231
|
+
}
|
232
|
+
|
233
|
+
```
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
59
239
|
### 試したこと
|
60
240
|
|
61
241
|
|