質問編集履歴
3
エラーメッセージの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -28,5 +28,9 @@
|
|
28
28
|
target.innerHTML = "JavaScriptが実行されました。";
|
29
29
|
}
|
30
30
|
```
|
31
|
-
|
31
|
+
```croleで出るエラーメッセージ
|
32
|
+
GET http://localhost:8080/userEdit.js net::ERR_ABORTED 404
|
33
|
+
```
|
34
|
+

|
32
|
-
HTMLとjsは同じ階層に配置しています。
|
35
|
+
HTMLとjsは同じ階層に配置しています。
|
36
|
+
HTMLにjs処理をベタ書きすると動くのですが、外部ファイルにすると動作しません。
|
2
ソースを詳しく
title
CHANGED
File without changes
|
body
CHANGED
@@ -11,9 +11,13 @@
|
|
11
11
|
<html lang="ja" xmlns:th="http://www.thymeleaf.org"
|
12
12
|
xmlns:sec="http://www.thymeleaf.org/extras/spring-security4">
|
13
13
|
<head>
|
14
|
+
<script type="text/javascript" src="userEdit.js"></script>
|
14
15
|
<meta charset="UTF-8">
|
15
|
-
<script type="text/javascript" src="userEdit.js"></script>
|
16
16
|
</head>
|
17
|
+
<body onload="proc();">
|
18
|
+
<div id="output"></div>
|
19
|
+
<div th:replace="common/globalnavi::globalnavi"></div>
|
20
|
+
===以下略===
|
17
21
|
```
|
18
22
|
```javascript
|
19
23
|
|
1
ソース追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
### 該当のソースコード
|
8
8
|
|
9
|
-
```
|
9
|
+
```html
|
10
10
|
<!DOCTYPE html>
|
11
11
|
<html lang="ja" xmlns:th="http://www.thymeleaf.org"
|
12
12
|
xmlns:sec="http://www.thymeleaf.org/extras/spring-security4">
|
@@ -15,4 +15,14 @@
|
|
15
15
|
<script type="text/javascript" src="userEdit.js"></script>
|
16
16
|
</head>
|
17
17
|
```
|
18
|
+
```javascript
|
19
|
+
|
20
|
+
window.onload = onLoad;
|
21
|
+
|
22
|
+
function onLoad() {
|
23
|
+
target = document.getElementById("output");
|
24
|
+
target.innerHTML = "JavaScriptが実行されました。";
|
25
|
+
}
|
26
|
+
```
|
27
|
+
|
18
28
|
HTMLとjsは同じ階層に配置しています。
|