From 02ac1594acdf9071a3e4112a0438e36cb7d867e8 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Sun, 30 Jan 2022 00:34:21 +0900 Subject: 2021/09/15 時点の英語版に同期 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ja/web/api/xmlhttprequest/load_event/index.md | 139 +++++++++------------ 1 file changed, 62 insertions(+), 77 deletions(-) (limited to 'files/ja') diff --git a/files/ja/web/api/xmlhttprequest/load_event/index.md b/files/ja/web/api/xmlhttprequest/load_event/index.md index 5ec8e20e9f..483f7b83e7 100644 --- a/files/ja/web/api/xmlhttprequest/load_event/index.md +++ b/files/ja/web/api/xmlhttprequest/load_event/index.md @@ -3,58 +3,59 @@ title: 'XMLHttpRequest: load イベント' slug: Web/API/XMLHttpRequest/load_event tags: - API - - Event + - イベント - ProgressEvent - - Web + - ウェブ - XMLHttpRequest - load - - イベント - - ウェブ +browser-compat: api.XMLHttpRequest.load_event translation_of: Web/API/XMLHttpRequest/load_event --- -
{{APIRef}}
+{{APIRef}} -

load イベントは、 {{domxref("XMLHttpRequest")}} のトランザクションが成功裏に完了したときに発生します。

+`load` イベントは、 {{domxref("XMLHttpRequest")}} のトランザクションが成功裏に完了したときに発行されます。 - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
バブリングなし
キャンセル可能いいえ
インターフェイス{{domxref("ProgressEvent")}}
イベントハンドラープロパティ{{domxref("XMLHttpRequestEventTarget/onload", "onload")}}
バブリングなし
キャンセル不可
インターフェイス{{domxref("ProgressEvent")}}
イベントハンドラープロパティ + {{domxref("XMLHttpRequestEventTarget/onload", "onload")}} +
-

+## 例 -

ライブデモ

+### ライブデモ -

HTML

+#### HTML -
<div class="controls">
-    <input class="xhr success" type="button" name="xhr" value="Click to start XHR (success)" />
-    <input class="xhr error" type="button" name="xhr" value="Click to start XHR (error)" />
-    <input class="xhr abort" type="button" name="xhr" value="Click to start XHR (abort)" />
-</div>
-
-<textarea readonly class="event-log"></textarea>
+```html +
+ + + +
- +``` -

JS

+#### JS -
const xhrButtonSuccess = document.querySelector('.xhr.success');
+```js
+const xhrButtonSuccess = document.querySelector('.xhr.success');
 const xhrButtonError = document.querySelector('.xhr.error');
 const xhrButtonAbort = document.querySelector('.xhr.abort');
 const log = document.querySelector('.event-log');
@@ -99,48 +100,32 @@ function runXHR(url) {
     return xhr;
 }
 
-xhrButtonSuccess.addEventListener('click', () => {
-    runXHR('https://mdn.mozillademos.org/files/16553/DgsZYJNXcAIPwzy.jpg');
+xhrButtonSuccess.addEventListener('click', () => {
+    runXHR('image.jpg');
 });
 
-xhrButtonError.addEventListener('click', () => {
+xhrButtonError.addEventListener('click', () => {
     runXHR('https://somewhere.org/i-dont-exist');
 });
 
-xhrButtonAbort.addEventListener('click', () => {
-    runXHR('https://mdn.mozillademos.org/files/16553/DgsZYJNXcAIPwzy.jpg').abort();
-});
- -

結果

- -

{{ EmbedLiveSample('Live_example', '100%', '150px') }}

- -

仕様書

- - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName('XMLHttpRequest', '#event-xhr-load')}}{{Spec2('XMLHttpRequest')}} 
+xhrButtonAbort.addEventListener('click', () => { + runXHR('image.jpg').abort(); +}); +``` + +#### 結果 + +{{ EmbedLiveSample('Live_example', '100%', '150px') }} + +## 仕様書 + +{{Specifications}} -

ブラウザーの対応

+## ブラウザーの互換性 -

{{Compat("api.XMLHttpRequest.load_event")}}

+{{Compat}} -

関連情報

+## 関連情報 - +- 関連イベント: {{domxref("XMLHttpRequest/loadstart_event", "loadstart")}}, {{domxref("XMLHttpRequest/loadend_event", "loadend")}}, {{domxref("XMLHttpRequest/progress_event", "progress")}}, {{domxref("XMLHttpRequest/error_event", "error")}}, {{domxref("XMLHttpRequest/abort_event", "abort")}} +- [進捗の監視](/ja/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#monitoring_progress) -- cgit v1.2.3-54-g00ecf