質問編集履歴
2
エラーメッセージの追記です
test
CHANGED
File without changes
|
test
CHANGED
@@ -199,3 +199,11 @@
|
|
199
199
|
});
|
200
200
|
|
201
201
|
```
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
##追記
|
206
|
+
|
207
|
+
##Access to internal resource at 'file:///C:/Users/User/Documents/javascript_seito/site.webmanifest' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.
|
208
|
+
|
209
|
+
となっています
|
1
コードを書きました
test
CHANGED
File without changes
|
test
CHANGED
@@ -9,3 +9,193 @@
|
|
9
9
|
###原因を確かめるために参考にしたコードをそのまま実行してもJavaScriptが実行されませんでした。 console.log('hello')のみでも実行されなかったのでコード以外の原因があるようです。 先週金曜日から解決法を見いだせていませんので力- リスト---をお貸しください。
|
10
10
|
|
11
11
|
[リンク内容](https://github.com/seito-developer/js-tutorial)
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
```
|
16
|
+
|
17
|
+
<!doctype html>
|
18
|
+
|
19
|
+
<html class="no-js" lang="">
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
<head>
|
24
|
+
|
25
|
+
<meta charset="utf-8">
|
26
|
+
|
27
|
+
<title></title>
|
28
|
+
|
29
|
+
<meta name="description" content="">
|
30
|
+
|
31
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
<link rel="manifest" href="site.webmanifest">
|
36
|
+
|
37
|
+
<link rel="apple-touch-icon" href="icon.png">
|
38
|
+
|
39
|
+
<!-- Place favicon.ico in the root directory -->
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
<meta name="theme-color" content="#fafafa">
|
48
|
+
|
49
|
+
</head>
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
<body>
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
<div class="container">
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
<div id="js-question" class="mt-3 alert alert-primary" role="alert">
|
62
|
+
|
63
|
+
A simple primary alert—check it out!
|
64
|
+
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div class="d-flex justify-content-center">
|
70
|
+
|
71
|
+
<button type="button" class="btn btn-primary">Primary</button>
|
72
|
+
|
73
|
+
<button type="button" class="ml-1 btn btn-primary">Primary</button>
|
74
|
+
|
75
|
+
<button type="button" class="ml-1 btn btn-primary">Primary</button>
|
76
|
+
|
77
|
+
<button type="button" class="ml-1 btn btn-primary">Primary</button>
|
78
|
+
|
79
|
+
</div>
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
<script src="index.js"></script>
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
</body>
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
</html>
|
96
|
+
|
97
|
+
```
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
```javascript
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
let unko = 'Hello World!';
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
const bigUnko = 'He..Hell...Hello World!';
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
const inoki = ['いーち','にーい','さーん','ダーー!!'];
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
let index = 0;
|
126
|
+
|
127
|
+
while(index < inoki.length){ //=4
|
128
|
+
|
129
|
+
// 繰り返したい命令
|
130
|
+
|
131
|
+
console.log(inoki[index]);
|
132
|
+
|
133
|
+
index++; //index = 5
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
//if / else
|
140
|
+
|
141
|
+
if(inoki.length > 5){
|
142
|
+
|
143
|
+
console.log('ボンバイエ!');
|
144
|
+
|
145
|
+
} else {
|
146
|
+
|
147
|
+
console.log('ボンバ...!');
|
148
|
+
|
149
|
+
}
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
//関数
|
154
|
+
|
155
|
+
const test = (arg) => {
|
156
|
+
|
157
|
+
//ここに実行したい命令を書く
|
158
|
+
|
159
|
+
if(inoki.length > arg){
|
160
|
+
|
161
|
+
console.log('ボンバイエ!');
|
162
|
+
|
163
|
+
} else {
|
164
|
+
|
165
|
+
console.log('ボンバ...!');
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
};
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
//オブジェクト
|
174
|
+
|
175
|
+
const unko2 = {
|
176
|
+
|
177
|
+
color: 'pink',
|
178
|
+
|
179
|
+
size: 'large',
|
180
|
+
|
181
|
+
purfume: 'mint',
|
182
|
+
|
183
|
+
goToilet: () => {
|
184
|
+
|
185
|
+
console.log('Hello world!');
|
186
|
+
|
187
|
+
}
|
188
|
+
|
189
|
+
};
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
document.getElementsByTagName('button')[0].addEventListener('click', ()=> {
|
194
|
+
|
195
|
+
//命令を書く
|
196
|
+
|
197
|
+
window.alert('Hello World!');
|
198
|
+
|
199
|
+
});
|
200
|
+
|
201
|
+
```
|