From 4873c5f1122ac800cf3c916a52df07e05ddc9dcf Mon Sep 17 00:00:00 2001 From: MDN Date: Fri, 11 Feb 2022 00:58:37 +0000 Subject: [CRON] sync translated content --- files/es/_redirects.txt | 5 +- files/es/_wikihistory.json | 26 ++-- files/es/web/api/animation/cancel_event/index.html | 116 ++++++++++++++++++ files/es/web/api/animation/finish_event/index.html | 132 +++++++++++++++++++++ files/es/web/api/animation/oncancel/index.html | 115 ------------------ files/es/web/api/animation/onfinish/index.html | 131 -------------------- .../xmlhttprequest/onreadystatechange/index.html | 109 ----------------- .../readystatechange_event/index.html | 110 +++++++++++++++++ files/fr/_redirects.txt | 2 + files/fr/_wikihistory.json | 18 +-- .../fr/web/api/xmlhttprequest/load_event/index.md | 41 +++++++ .../api/xmlhttprequest/onreadystatechange/index.md | 44 ------- .../xmlhttprequest/readystatechange_event/index.md | 45 +++++++ .../api/xmlhttprequesteventtarget/onload/index.md | 40 ------- files/ja/_redirects.txt | 6 + files/ja/_wikihistory.json | 67 +++-------- .../web/api/xmlhttprequest/abort_event/index.html | 64 ++++++++++ .../web/api/xmlhttprequest/error_event/index.html | 62 ++++++++++ .../web/api/xmlhttprequest/load_event/index.html | 62 ++++++++++ .../api/xmlhttprequest/loadstart_event/index.html | 62 ++++++++++ .../api/xmlhttprequest/onreadystatechange/index.md | 60 ---------- .../api/xmlhttprequest/progress_event/index.html | 74 ++++++++++++ .../xmlhttprequest/readystatechange_event/index.md | 61 ++++++++++ .../xmlhttprequesteventtarget/onabort/index.html | 63 ---------- .../xmlhttprequesteventtarget/onerror/index.html | 61 ---------- .../xmlhttprequesteventtarget/onload/index.html | 61 ---------- .../onloadstart/index.html | 61 ---------- .../onprogress/index.html | 73 ------------ files/pt-br/_redirects.txt | 1 + files/pt-br/_wikihistory.json | 14 +-- .../xmlhttprequest/onreadystatechange/index.html | 120 ------------------- .../readystatechange_event/index.html | 121 +++++++++++++++++++ files/ru/_redirects.txt | 1 + files/ru/_wikihistory.json | 12 +- .../xmlhttprequest/onreadystatechange/index.html | 54 --------- .../readystatechange_event/index.html | 55 +++++++++ files/zh-cn/_redirects.txt | 7 ++ files/zh-cn/_wikihistory.json | 92 +++++++------- .../web/api/xmlhttprequest/abort_event/index.html | 57 +++++++++ .../web/api/xmlhttprequest/error_event/index.html | 61 ++++++++++ .../web/api/xmlhttprequest/load_event/index.html | 55 +++++++++ .../api/xmlhttprequest/loadstart_event/index.html | 55 +++++++++ .../api/xmlhttprequest/progress_event/index.html | 65 ++++++++++ .../web/api/animation/cancel_event/index.html | 112 +++++++++++++++++ files/zh-cn/web/api/animation/oncancel/index.html | 111 ----------------- .../xmlhttprequest/onreadystatechange/index.html | 120 ------------------- .../readystatechange_event/index.html | 121 +++++++++++++++++++ .../xmlhttprequesteventtarget/onabort/index.html | 56 --------- .../xmlhttprequesteventtarget/onerror/index.html | 60 ---------- .../xmlhttprequesteventtarget/onload/index.html | 54 --------- .../onloadstart/index.html | 54 --------- .../onprogress/index.html | 64 ---------- files/zh-tw/_redirects.txt | 1 + files/zh-tw/_wikihistory.json | 12 +- .../xmlhttprequest/onreadystatechange/index.html | 113 ------------------ .../readystatechange_event/index.html | 114 ++++++++++++++++++ 56 files changed, 1771 insertions(+), 1762 deletions(-) create mode 100644 files/es/web/api/animation/cancel_event/index.html create mode 100644 files/es/web/api/animation/finish_event/index.html delete mode 100644 files/es/web/api/animation/oncancel/index.html delete mode 100644 files/es/web/api/animation/onfinish/index.html delete mode 100644 files/es/web/api/xmlhttprequest/onreadystatechange/index.html create mode 100644 files/es/web/api/xmlhttprequest/readystatechange_event/index.html create mode 100644 files/fr/web/api/xmlhttprequest/load_event/index.md delete mode 100644 files/fr/web/api/xmlhttprequest/onreadystatechange/index.md create mode 100644 files/fr/web/api/xmlhttprequest/readystatechange_event/index.md delete mode 100644 files/fr/web/api/xmlhttprequesteventtarget/onload/index.md create mode 100644 files/ja/web/api/xmlhttprequest/abort_event/index.html create mode 100644 files/ja/web/api/xmlhttprequest/error_event/index.html create mode 100644 files/ja/web/api/xmlhttprequest/load_event/index.html create mode 100644 files/ja/web/api/xmlhttprequest/loadstart_event/index.html delete mode 100644 files/ja/web/api/xmlhttprequest/onreadystatechange/index.md create mode 100644 files/ja/web/api/xmlhttprequest/progress_event/index.html create mode 100644 files/ja/web/api/xmlhttprequest/readystatechange_event/index.md delete mode 100644 files/ja/web/api/xmlhttprequesteventtarget/onabort/index.html delete mode 100644 files/ja/web/api/xmlhttprequesteventtarget/onerror/index.html delete mode 100644 files/ja/web/api/xmlhttprequesteventtarget/onload/index.html delete mode 100644 files/ja/web/api/xmlhttprequesteventtarget/onloadstart/index.html delete mode 100644 files/ja/web/api/xmlhttprequesteventtarget/onprogress/index.html delete mode 100644 files/pt-br/web/api/xmlhttprequest/onreadystatechange/index.html create mode 100644 files/pt-br/web/api/xmlhttprequest/readystatechange_event/index.html delete mode 100644 files/ru/web/api/xmlhttprequest/onreadystatechange/index.html create mode 100644 files/ru/web/api/xmlhttprequest/readystatechange_event/index.html create mode 100644 files/zh-cn/conflicting/web/api/xmlhttprequest/abort_event/index.html create mode 100644 files/zh-cn/conflicting/web/api/xmlhttprequest/error_event/index.html create mode 100644 files/zh-cn/conflicting/web/api/xmlhttprequest/load_event/index.html create mode 100644 files/zh-cn/conflicting/web/api/xmlhttprequest/loadstart_event/index.html create mode 100644 files/zh-cn/conflicting/web/api/xmlhttprequest/progress_event/index.html create mode 100644 files/zh-cn/web/api/animation/cancel_event/index.html delete mode 100644 files/zh-cn/web/api/animation/oncancel/index.html delete mode 100644 files/zh-cn/web/api/xmlhttprequest/onreadystatechange/index.html create mode 100644 files/zh-cn/web/api/xmlhttprequest/readystatechange_event/index.html delete mode 100644 files/zh-cn/web/api/xmlhttprequesteventtarget/onabort/index.html delete mode 100644 files/zh-cn/web/api/xmlhttprequesteventtarget/onerror/index.html delete mode 100644 files/zh-cn/web/api/xmlhttprequesteventtarget/onload/index.html delete mode 100644 files/zh-cn/web/api/xmlhttprequesteventtarget/onloadstart/index.html delete mode 100644 files/zh-cn/web/api/xmlhttprequesteventtarget/onprogress/index.html delete mode 100644 files/zh-tw/web/api/xmlhttprequest/onreadystatechange/index.html create mode 100644 files/zh-tw/web/api/xmlhttprequest/readystatechange_event/index.html diff --git a/files/es/_redirects.txt b/files/es/_redirects.txt index 6f58b5654c..402d778b73 100644 --- a/files/es/_redirects.txt +++ b/files/es/_redirects.txt @@ -1510,6 +1510,8 @@ /es/docs/Web/API/API_de_almacenamiento_web/Usando_la_API_de_almacenamiento_web /es/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API /es/docs/Web/API/API_del_portapapeles /es/docs/Web/API/Clipboard_API /es/docs/Web/API/Animation/Animación /es/docs/Web/API/Animation/Animation +/es/docs/Web/API/Animation/oncancel /es/docs/Web/API/Animation/cancel_event +/es/docs/Web/API/Animation/onfinish /es/docs/Web/API/Animation/finish_event /es/docs/Web/API/Animation/terminado /es/docs/Web/API/Animation/finished /es/docs/Web/API/Animation/tiempoActual /es/docs/Web/API/Animation/currentTime /es/docs/Web/API/BatteryManager.charging /es/docs/Web/API/BatteryManager/charging @@ -1603,6 +1605,7 @@ /es/docs/Web/API/WindowTimers/setInterval /es/docs/Web/API/setInterval /es/docs/Web/API/WindowTimers/setTimeout /es/docs/Web/API/setTimeout /es/docs/Web/API/XMLHttpRequest/FormData /es/docs/Web/API/FormData +/es/docs/Web/API/XMLHttpRequest/onreadystatechange /es/docs/Web/API/XMLHttpRequest/readystatechange_event /es/docs/Web/API/event.defaultPrevented /es/docs/Web/API/Event/defaultPrevented /es/docs/Web/API/event.which /es/docs/Web/API/UIEvent/which /es/docs/Web/Accesibilidad /es/docs/Web/Accessibility @@ -2592,7 +2595,7 @@ /es/docs/XMLHttpRequest/FormData /es/docs/Web/API/FormData /es/docs/XMLHttpRequest/Using_XMLHttpRequest /es/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest /es/docs/XMLHttpRequest/abort /es/docs/Web/API/XMLHttpRequest/abort -/es/docs/XMLHttpRequest/onreadystatechange /es/docs/Web/API/XMLHttpRequest/onreadystatechange +/es/docs/XMLHttpRequest/onreadystatechange /es/docs/Web/API/XMLHttpRequest/readystatechange_event /es/docs/XPath /es/docs/Web/XPath /es/docs/XPath/Ejes /es/docs/Web/XPath/Axes /es/docs/XPath/Ejes/ancestor /es/docs/Web/XPath/Axes/ancestor diff --git a/files/es/_wikihistory.json b/files/es/_wikihistory.json index 221a50c96e..266f1db625 100644 --- a/files/es/_wikihistory.json +++ b/files/es/_wikihistory.json @@ -4743,6 +4743,12 @@ "IngoBongo" ] }, + "Web/API/Animation/cancel_event": { + "modified": "2019-03-23T22:05:09.237Z", + "contributors": [ + "IngoBongo" + ] + }, "Web/API/Animation/currentTime": { "modified": "2019-03-23T22:05:12.506Z", "contributors": [ @@ -4761,26 +4767,20 @@ "IngoBongo" ] }, - "Web/API/Animation/finished": { - "modified": "2019-03-23T22:05:06.573Z", - "contributors": [ - "IngoBongo" - ] - }, - "Web/API/Animation/id": { - "modified": "2019-03-18T21:15:30.202Z", + "Web/API/Animation/finish_event": { + "modified": "2019-03-23T22:05:11.188Z", "contributors": [ "IngoBongo" ] }, - "Web/API/Animation/oncancel": { - "modified": "2019-03-23T22:05:09.237Z", + "Web/API/Animation/finished": { + "modified": "2019-03-23T22:05:06.573Z", "contributors": [ "IngoBongo" ] }, - "Web/API/Animation/onfinish": { - "modified": "2019-03-23T22:05:11.188Z", + "Web/API/Animation/id": { + "modified": "2019-03-18T21:15:30.202Z", "contributors": [ "IngoBongo" ] @@ -9142,7 +9142,7 @@ "darioperez" ] }, - "Web/API/XMLHttpRequest/onreadystatechange": { + "Web/API/XMLHttpRequest/readystatechange_event": { "modified": "2019-03-23T22:20:14.868Z", "contributors": [ "Sheppy", diff --git a/files/es/web/api/animation/cancel_event/index.html b/files/es/web/api/animation/cancel_event/index.html new file mode 100644 index 0000000000..94e730d509 --- /dev/null +++ b/files/es/web/api/animation/cancel_event/index.html @@ -0,0 +1,116 @@ +--- +title: Animation.oncancel +slug: Web/API/Animation/cancel_event +tags: + - API + - Animacion + - Animaciones Web + - Experimental + - Reference + - oncancel +translation_of: Web/API/Animation/oncancel +original_slug: Web/API/Animation/oncancel +--- +

{{ SeeCompatTable() }}{{ APIRef("Web Animations") }}

+ +

La propiedad oncancel de la interfaz {{domxref("Animation")}} de la  Web Animations API es el manejador de eventos para el evento {{event("cancel")}} .

+ +

El evento cancel puede ser activado manualmente con {{domxref("Animation.cancel()")}} cuando la animación entra en estado de reproducción "idle"(inactivo) desde otro estado, como cuando una animación se elimina de un elemento antes de que termine de reproducirse.

+ +
+

La creación de una nueva animación, inicialmente inactiva, no activa el evento {{event("cancel")}} en la nueva animación.

+
+ +

Sintaxis

+ +
var cancelHandler = Animation.oncancel;
+
+Animation.oncancel = cancelHandler;
+ +

Valor

+ +

Una función que será ejecutada cuando la animación sea cancelada, o null si no hay un manejador de eventos {{event("cancel")}}.

+ +

Ejemplos

+ +

Si esta animación es cancelada, elimina su elemento.

+ +
animation.oncancel = animation.effect.target.remove();
+
+ +

Especificaciones

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('Web Animations', '#dom-animation-oncancel', 'Animation.oncancel' )}}{{Spec2('Web Animations')}}Editor's draft.
+ +

Compatibilidad del navegador

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{CompatChrome(39.0)}}{{CompatGeckoDesktop(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatGeckoMobile(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +

[1] La Web Animations API solo está habilitada por defecto en Firefox Developer Edition y Nightly builds. Puedes habilitarlo en versiones Beta y de lanzamiento estableciendo la preferencia dom.animations-api.core.enabled en true, y puedes deshabilitarlo en cualquier versión de Firefox estableciendo esta propiedad en false.

+ +

Ver también

+ + diff --git a/files/es/web/api/animation/finish_event/index.html b/files/es/web/api/animation/finish_event/index.html new file mode 100644 index 0000000000..5bf34bc5be --- /dev/null +++ b/files/es/web/api/animation/finish_event/index.html @@ -0,0 +1,132 @@ +--- +title: Animation.onfinish +slug: Web/API/Animation/finish_event +tags: + - API + - Animacion + - Animaciones Web + - Experimental + - Reference + - onfinish + - waapi +translation_of: Web/API/Animation/onfinish +original_slug: Web/API/Animation/onfinish +--- +

{{ SeeCompatTable() }}{{ APIRef("Web Animations") }}

+ +

La propiedad onfinish de la interfaz {{domxref("Animation")}} (de la Web Animations API) es el manejador de eventos para el evento {{event("finish")}}. Este evento se envía cuando la animación termina de reproducirse.

+ +

El evento finish ocurre cuando la reproducción se completa de forma natural, así como cuando se llama al  método {{domxref("Animation.finish()")}} para que la animación termine inmediatamente.

+ +
+

El estado de reproducción "paused" reemplaza al estado  "finished" ; Si la animación está pausada y finalizada, el estado"paused" será el único reportado. Puedes forzar el estado de la animación a "finished" configurando su {{domxref("Animation.startTime", "startTime")}} a document.timeline.currentTime - (Animation.currentTime * Animation.playbackRate).

+
+ +

Sintaxis

+ +
var finishHandler = Animation.onfinish;
+
+Animation.onfinish = finishHandler;
+ +

Valor

+ +

Una función que debe ser llamada para manejar el evento {{event("finish")}} , o null si no se establece ningún manejador para el evento finish.

+ +

Ejemplos

+ +

Animation.onfinish es utilizado en varias ocasiones en el juego de Alice in Web Animations API Land Growing/Shrinking Alice Game.  Aquí hay una instancia en la que agregamos eventos de puntero a un elemento después de que su animación de opacidad se haya desvanecido:

+ +
// Agrega una animación a los créditos finales del juego.
+var endingUI = document.getElementById("ending-ui");
+var bringUI = endingUI.animate(keysFade, timingFade);
+
+// Pone en Pausa dichos créditos.
+bringUI.pause();
+
+// Esta función elimina los eventos de puntero en los créditos.
+hide(endingUI);
+
+// Cuando los créditos se hayan desvanecido,
+// volvemos a agregar los eventos de puntero cuando terminen.
+bringUI.onfinish = function() {
+  endingUI.style.pointerEvents = 'auto';
+};
+
+
+ +

Especificaciones

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('Web Animations', '#dom-animation-onfinish', 'Animation.onfinish' )}}{{Spec2('Web Animations')}}Editor's draft.
+ +

Browser compatibility

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{CompatChrome(39.0)}}{{CompatGeckoDesktop(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatGeckoMobile(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +

[1]  La Web Animations API solo está habilitada por defecto en Firefox Developer Edition y Nightly builds. Puedes habilitarlo en versiones Beta y de lanzamiento estableciendo la preferencia dom.animations-api.core.enabled en true, y puedes deshabilitarlo en cualquier versión de Firefox estableciendo esta propiedad en false.

+ +

Ver también

+ + diff --git a/files/es/web/api/animation/oncancel/index.html b/files/es/web/api/animation/oncancel/index.html deleted file mode 100644 index 1f09835210..0000000000 --- a/files/es/web/api/animation/oncancel/index.html +++ /dev/null @@ -1,115 +0,0 @@ ---- -title: Animation.oncancel -slug: Web/API/Animation/oncancel -tags: - - API - - Animacion - - Animaciones Web - - Experimental - - Reference - - oncancel -translation_of: Web/API/Animation/oncancel ---- -

{{ SeeCompatTable() }}{{ APIRef("Web Animations") }}

- -

La propiedad oncancel de la interfaz {{domxref("Animation")}} de la  Web Animations API es el manejador de eventos para el evento {{event("cancel")}} .

- -

El evento cancel puede ser activado manualmente con {{domxref("Animation.cancel()")}} cuando la animación entra en estado de reproducción "idle"(inactivo) desde otro estado, como cuando una animación se elimina de un elemento antes de que termine de reproducirse.

- -
-

La creación de una nueva animación, inicialmente inactiva, no activa el evento {{event("cancel")}} en la nueva animación.

-
- -

Sintaxis

- -
var cancelHandler = Animation.oncancel;
-
-Animation.oncancel = cancelHandler;
- -

Valor

- -

Una función que será ejecutada cuando la animación sea cancelada, o null si no hay un manejador de eventos {{event("cancel")}}.

- -

Ejemplos

- -

Si esta animación es cancelada, elimina su elemento.

- -
animation.oncancel = animation.effect.target.remove();
-
- -

Especificaciones

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('Web Animations', '#dom-animation-oncancel', 'Animation.oncancel' )}}{{Spec2('Web Animations')}}Editor's draft.
- -

Compatibilidad del navegador

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{CompatChrome(39.0)}}{{CompatGeckoDesktop(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - -
FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatGeckoMobile(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -

[1] La Web Animations API solo está habilitada por defecto en Firefox Developer Edition y Nightly builds. Puedes habilitarlo en versiones Beta y de lanzamiento estableciendo la preferencia dom.animations-api.core.enabled en true, y puedes deshabilitarlo en cualquier versión de Firefox estableciendo esta propiedad en false.

- -

Ver también

- - diff --git a/files/es/web/api/animation/onfinish/index.html b/files/es/web/api/animation/onfinish/index.html deleted file mode 100644 index 592014f698..0000000000 --- a/files/es/web/api/animation/onfinish/index.html +++ /dev/null @@ -1,131 +0,0 @@ ---- -title: Animation.onfinish -slug: Web/API/Animation/onfinish -tags: - - API - - Animacion - - Animaciones Web - - Experimental - - Reference - - onfinish - - waapi -translation_of: Web/API/Animation/onfinish ---- -

{{ SeeCompatTable() }}{{ APIRef("Web Animations") }}

- -

La propiedad onfinish de la interfaz {{domxref("Animation")}} (de la Web Animations API) es el manejador de eventos para el evento {{event("finish")}}. Este evento se envía cuando la animación termina de reproducirse.

- -

El evento finish ocurre cuando la reproducción se completa de forma natural, así como cuando se llama al  método {{domxref("Animation.finish()")}} para que la animación termine inmediatamente.

- -
-

El estado de reproducción "paused" reemplaza al estado  "finished" ; Si la animación está pausada y finalizada, el estado"paused" será el único reportado. Puedes forzar el estado de la animación a "finished" configurando su {{domxref("Animation.startTime", "startTime")}} a document.timeline.currentTime - (Animation.currentTime * Animation.playbackRate).

-
- -

Sintaxis

- -
var finishHandler = Animation.onfinish;
-
-Animation.onfinish = finishHandler;
- -

Valor

- -

Una función que debe ser llamada para manejar el evento {{event("finish")}} , o null si no se establece ningún manejador para el evento finish.

- -

Ejemplos

- -

Animation.onfinish es utilizado en varias ocasiones en el juego de Alice in Web Animations API Land Growing/Shrinking Alice Game.  Aquí hay una instancia en la que agregamos eventos de puntero a un elemento después de que su animación de opacidad se haya desvanecido:

- -
// Agrega una animación a los créditos finales del juego.
-var endingUI = document.getElementById("ending-ui");
-var bringUI = endingUI.animate(keysFade, timingFade);
-
-// Pone en Pausa dichos créditos.
-bringUI.pause();
-
-// Esta función elimina los eventos de puntero en los créditos.
-hide(endingUI);
-
-// Cuando los créditos se hayan desvanecido,
-// volvemos a agregar los eventos de puntero cuando terminen.
-bringUI.onfinish = function() {
-  endingUI.style.pointerEvents = 'auto';
-};
-
-
- -

Especificaciones

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('Web Animations', '#dom-animation-onfinish', 'Animation.onfinish' )}}{{Spec2('Web Animations')}}Editor's draft.
- -

Browser compatibility

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{CompatChrome(39.0)}}{{CompatGeckoDesktop(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - -
FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatGeckoMobile(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -

[1]  La Web Animations API solo está habilitada por defecto en Firefox Developer Edition y Nightly builds. Puedes habilitarlo en versiones Beta y de lanzamiento estableciendo la preferencia dom.animations-api.core.enabled en true, y puedes deshabilitarlo en cualquier versión de Firefox estableciendo esta propiedad en false.

- -

Ver también

- - diff --git a/files/es/web/api/xmlhttprequest/onreadystatechange/index.html b/files/es/web/api/xmlhttprequest/onreadystatechange/index.html deleted file mode 100644 index 7f35ad3e88..0000000000 --- a/files/es/web/api/xmlhttprequest/onreadystatechange/index.html +++ /dev/null @@ -1,109 +0,0 @@ ---- -title: XMLHttpRequest.onreadystatechange -slug: Web/API/XMLHttpRequest/onreadystatechange -translation_of: Web/API/XMLHttpRequest/onreadystatechange ---- -
{{APIRef}}
- -

Un EventHandler que es invocado cada vez que cambia el atributo readyState. La retrollamada (callback) es invocada desde el hilo (thread) perteneciente a la interfaz de usuario. La propiedad XMLHttpRequest.onreadystatechange contiene el manejador del evento que es invocado cuando se dispara el evento {{event("readystatechange")}}, lo cual sucede cada vez que cambia el valor de la propiedad {{domxref("XMLHttpRequest.readyState", "readyState")}} de {{domxref("XMLHttpRequest")}}. La retrollamada (callback) es invocada desde el hilo perteneciente a la interfaz de usuario.

- -
-

Aviso: No debería ser usado con peticiones síncronas ni tampoco en código nativo.

-
- -

El evento readystatechange no se disparará cuando una petición XMLHttpRequest sea cancelada mediante el método abort().

- -

Sintaxis

- -
XMLHttpRequest.onreadystatechange = callback;
- -

Valores

- - - -

Ejemplo

- -
var xhr = new XMLHttpRequest(),
-    method = "GET",
-    url = "https://developer.mozilla.org/";
-
-xhr.open(method, url, true);
-xhr.onreadystatechange = function () {
-        if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
-            console.log(xhr.responseText);
-        }
-    };
-xhr.send();
- -

Especificaciones

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('XMLHttpRequest', '#handler-xhr-onreadystatechange')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

Compatibilidad con navegadores Web

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(1)}}{{CompatGeckoDesktop(1.0)}}{{CompatIe(7)}}[1]{{CompatVersionUnknown}}{{CompatSafari(1.2)}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}1.0{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
- -

[1] Las versiones 5 y 6 admiten llamadas AJAX usando ActiveXObject().

diff --git a/files/es/web/api/xmlhttprequest/readystatechange_event/index.html b/files/es/web/api/xmlhttprequest/readystatechange_event/index.html new file mode 100644 index 0000000000..4b68a7b267 --- /dev/null +++ b/files/es/web/api/xmlhttprequest/readystatechange_event/index.html @@ -0,0 +1,110 @@ +--- +title: XMLHttpRequest.onreadystatechange +slug: Web/API/XMLHttpRequest/readystatechange_event +translation_of: Web/API/XMLHttpRequest/onreadystatechange +original_slug: Web/API/XMLHttpRequest/onreadystatechange +--- +
{{APIRef}}
+ +

Un EventHandler que es invocado cada vez que cambia el atributo readyState. La retrollamada (callback) es invocada desde el hilo (thread) perteneciente a la interfaz de usuario. La propiedad XMLHttpRequest.onreadystatechange contiene el manejador del evento que es invocado cuando se dispara el evento {{event("readystatechange")}}, lo cual sucede cada vez que cambia el valor de la propiedad {{domxref("XMLHttpRequest.readyState", "readyState")}} de {{domxref("XMLHttpRequest")}}. La retrollamada (callback) es invocada desde el hilo perteneciente a la interfaz de usuario.

+ +
+

Aviso: No debería ser usado con peticiones síncronas ni tampoco en código nativo.

+
+ +

El evento readystatechange no se disparará cuando una petición XMLHttpRequest sea cancelada mediante el método abort().

+ +

Sintaxis

+ +
XMLHttpRequest.onreadystatechange = callback;
+ +

Valores

+ + + +

Ejemplo

+ +
var xhr = new XMLHttpRequest(),
+    method = "GET",
+    url = "https://developer.mozilla.org/";
+
+xhr.open(method, url, true);
+xhr.onreadystatechange = function () {
+        if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
+            console.log(xhr.responseText);
+        }
+    };
+xhr.send();
+ +

Especificaciones

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('XMLHttpRequest', '#handler-xhr-onreadystatechange')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

Compatibilidad con navegadores Web

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(1)}}{{CompatGeckoDesktop(1.0)}}{{CompatIe(7)}}[1]{{CompatVersionUnknown}}{{CompatSafari(1.2)}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}1.0{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +

[1] Las versiones 5 y 6 admiten llamadas AJAX usando ActiveXObject().

diff --git a/files/fr/_redirects.txt b/files/fr/_redirects.txt index 790e5e1098..aa042cdec3 100644 --- a/files/fr/_redirects.txt +++ b/files/fr/_redirects.txt @@ -3824,6 +3824,8 @@ /fr/docs/Web/API/WorkerGlobalScope/close /fr/docs/conflicting/Web/API/DedicatedWorkerGlobalScope/close /fr/docs/Web/API/WorkerGlobalScope/onclose /fr/docs/conflicting/Web/API/DedicatedWorkerGlobalScope/close_ad209d73ce2abfe0e3fe136acf40e5b4 /fr/docs/Web/API/XMLHttpRequest/Utiliser_XMLHttpRequest /fr/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest +/fr/docs/Web/API/XMLHttpRequest/onreadystatechange /fr/docs/Web/API/XMLHttpRequest/readystatechange_event +/fr/docs/Web/API/XMLHttpRequestEventTarget/onload /fr/docs/Web/API/XMLHttpRequest/load_event /fr/docs/Web/API/console.log /fr/docs/Web/API/Console/log /fr/docs/Web/API/console.time /fr/docs/Web/API/Console/time /fr/docs/Web/API/console.timeEnd /fr/docs/Web/API/Console/timeEnd diff --git a/files/fr/_wikihistory.json b/files/fr/_wikihistory.json index a65b7be9f1..433a88c540 100644 --- a/files/fr/_wikihistory.json +++ b/files/fr/_wikihistory.json @@ -21652,10 +21652,10 @@ "Kalwyn" ] }, - "Web/API/XMLHttpRequest/onreadystatechange": { - "modified": "2020-10-15T22:12:50.281Z", + "Web/API/XMLHttpRequest/load_event": { + "modified": "2020-10-15T22:31:14.653Z", "contributors": [ - "AdminXVII" + "fatmalimem19" ] }, "Web/API/XMLHttpRequest/open": { @@ -21670,6 +21670,12 @@ "devweb157" ] }, + "Web/API/XMLHttpRequest/readystatechange_event": { + "modified": "2020-10-15T22:12:50.281Z", + "contributors": [ + "AdminXVII" + ] + }, "Web/API/XMLHttpRequest/response": { "modified": "2019-03-18T21:46:41.662Z", "contributors": [ @@ -21723,12 +21729,6 @@ "devweb157" ] }, - "Web/API/XMLHttpRequestEventTarget/onload": { - "modified": "2020-10-15T22:31:14.653Z", - "contributors": [ - "fatmalimem19" - ] - }, "Web/API/XMLSerializer": { "modified": "2019-03-23T23:46:38.004Z", "contributors": [ diff --git a/files/fr/web/api/xmlhttprequest/load_event/index.md b/files/fr/web/api/xmlhttprequest/load_event/index.md new file mode 100644 index 0000000000..8d314127c3 --- /dev/null +++ b/files/fr/web/api/xmlhttprequest/load_event/index.md @@ -0,0 +1,41 @@ +--- +title: XMLHttpRequestEventTarget.onload +slug: Web/API/XMLHttpRequest/load_event +translation_of: Web/API/XMLHttpRequestEventTarget/onload +original_slug: Web/API/XMLHttpRequestEventTarget/onload +--- +{{APIRef("XMLHttpRequest")}} + +The **`XMLHttpRequestEventTarget.onload`** is the function called when an {{domxref("XMLHttpRequest")}} transaction completes successfully. + +## Syntax + + XMLHttpRequest.onload = callback; + +### Values + +- `callback` is the function to be executed when the request completes successfully. It receives a {{domxref("ProgressEvent")}} object as its first argument. The value of *this* (i.e. the context) is the same {{domxref("XMLHttpRequest")}} this callback is related to. + +## Example + +```js +var xmlhttp = new XMLHttpRequest(), + method = 'GET', + url = 'https://developer.mozilla.org/'; + +xmlhttp.open(method, url, true); +xmlhttp.onload = function () { + // Do something with the retrieved data ( found in xmlhttp.response ) +}; +xmlhttp.send(); +``` + +## Specifications + +| Specification | Status | Comment | +| ------------------------------------------------------------------------ | ------------------------------------ | ---------------------- | +| {{SpecName('XMLHttpRequest', '#handler-xhr-onload')}} | {{Spec2('XMLHttpRequest')}} | WHATWG living standard | + +## Browser compatibility + +{{Compat("api.XMLHttpRequestEventTarget.onload")}} diff --git a/files/fr/web/api/xmlhttprequest/onreadystatechange/index.md b/files/fr/web/api/xmlhttprequest/onreadystatechange/index.md deleted file mode 100644 index cafc71025b..0000000000 --- a/files/fr/web/api/xmlhttprequest/onreadystatechange/index.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: XMLHttpRequest.onreadystatechange -slug: Web/API/XMLHttpRequest/onreadystatechange -translation_of: Web/API/XMLHttpRequest/onreadystatechange ---- -{{APIRef}} - -Un [`EventHandler`](/en-US/docs/Web/API/EventHandler) qui réagit aux changements de `readyState`. Le callback est appelé dans le contexte du thread de rendu. La propriété **`XMLHttpRequest.onreadystatechange`**  contient le gestionnaire d'évènement appelé lorsque l'évènement {{event("readystatechange")}} est déclenché, soit chaque fois que la propriété {{domxref("XMLHttpRequest.readyState", "readyState")}} de {{domxref("XMLHttpRequest")}} est modifiée. - -> **Attention :** Ne doit pas être utilisé avec des requêtes synchrone ni avec du code natif. - -## Syntaxe - - XMLHttpRequest.onreadystatechange = callback; - -### Valeurs - -- `callback` est la fonction exécutée lorsque `readyState` change. - -## Exemple - -```js -var xhr = new XMLHttpRequest(), - method = "GET", - url = "https://developer.mozilla.org/"; - -xhr.open(method, url, true); -xhr.onreadystatechange = function () { - if(xhr.readyState === 4 && xhr.status === 200) { -  console.log(xhr.responseText); -  } -}; -xhr.send(); -``` - -## Spécifications - -| Specification | Status | Comment | -| ---------------------------------------------------------------------------------------- | ------------------------------------ | ---------------------- | -| {{SpecName('XMLHttpRequest', '#handler-xhr-onreadystatechange')}} | {{Spec2('XMLHttpRequest')}} | WHATWG living standard | - -## Compatibilité des fureteurs - -{{Compat("api.XMLHttpRequest.onreadystatechange")}} diff --git a/files/fr/web/api/xmlhttprequest/readystatechange_event/index.md b/files/fr/web/api/xmlhttprequest/readystatechange_event/index.md new file mode 100644 index 0000000000..c9cf4293db --- /dev/null +++ b/files/fr/web/api/xmlhttprequest/readystatechange_event/index.md @@ -0,0 +1,45 @@ +--- +title: XMLHttpRequest.onreadystatechange +slug: Web/API/XMLHttpRequest/readystatechange_event +translation_of: Web/API/XMLHttpRequest/onreadystatechange +original_slug: Web/API/XMLHttpRequest/onreadystatechange +--- +{{APIRef}} + +Un [`EventHandler`](/en-US/docs/Web/API/EventHandler) qui réagit aux changements de `readyState`. Le callback est appelé dans le contexte du thread de rendu. La propriété **`XMLHttpRequest.onreadystatechange`**  contient le gestionnaire d'évènement appelé lorsque l'évènement {{event("readystatechange")}} est déclenché, soit chaque fois que la propriété {{domxref("XMLHttpRequest.readyState", "readyState")}} de {{domxref("XMLHttpRequest")}} est modifiée. + +> **Attention :** Ne doit pas être utilisé avec des requêtes synchrone ni avec du code natif. + +## Syntaxe + + XMLHttpRequest.onreadystatechange = callback; + +### Valeurs + +- `callback` est la fonction exécutée lorsque `readyState` change. + +## Exemple + +```js +var xhr = new XMLHttpRequest(), + method = "GET", + url = "https://developer.mozilla.org/"; + +xhr.open(method, url, true); +xhr.onreadystatechange = function () { + if(xhr.readyState === 4 && xhr.status === 200) { +  console.log(xhr.responseText); +  } +}; +xhr.send(); +``` + +## Spécifications + +| Specification | Status | Comment | +| ---------------------------------------------------------------------------------------- | ------------------------------------ | ---------------------- | +| {{SpecName('XMLHttpRequest', '#handler-xhr-onreadystatechange')}} | {{Spec2('XMLHttpRequest')}} | WHATWG living standard | + +## Compatibilité des fureteurs + +{{Compat("api.XMLHttpRequest.onreadystatechange")}} diff --git a/files/fr/web/api/xmlhttprequesteventtarget/onload/index.md b/files/fr/web/api/xmlhttprequesteventtarget/onload/index.md deleted file mode 100644 index b3242e022c..0000000000 --- a/files/fr/web/api/xmlhttprequesteventtarget/onload/index.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onload -slug: Web/API/XMLHttpRequestEventTarget/onload -translation_of: Web/API/XMLHttpRequestEventTarget/onload ---- -{{APIRef("XMLHttpRequest")}} - -The **`XMLHttpRequestEventTarget.onload`** is the function called when an {{domxref("XMLHttpRequest")}} transaction completes successfully. - -## Syntax - - XMLHttpRequest.onload = callback; - -### Values - -- `callback` is the function to be executed when the request completes successfully. It receives a {{domxref("ProgressEvent")}} object as its first argument. The value of *this* (i.e. the context) is the same {{domxref("XMLHttpRequest")}} this callback is related to. - -## Example - -```js -var xmlhttp = new XMLHttpRequest(), - method = 'GET', - url = 'https://developer.mozilla.org/'; - -xmlhttp.open(method, url, true); -xmlhttp.onload = function () { - // Do something with the retrieved data ( found in xmlhttp.response ) -}; -xmlhttp.send(); -``` - -## Specifications - -| Specification | Status | Comment | -| ------------------------------------------------------------------------ | ------------------------------------ | ---------------------- | -| {{SpecName('XMLHttpRequest', '#handler-xhr-onload')}} | {{Spec2('XMLHttpRequest')}} | WHATWG living standard | - -## Browser compatibility - -{{Compat("api.XMLHttpRequestEventTarget.onload")}} diff --git a/files/ja/_redirects.txt b/files/ja/_redirects.txt index 888b741d3b..d38381b778 100644 --- a/files/ja/_redirects.txt +++ b/files/ja/_redirects.txt @@ -3361,7 +3361,13 @@ /ja/docs/Web/API/WindowTimers/setInterval /ja/docs/Web/API/setInterval /ja/docs/Web/API/WindowTimers/setTimeout /ja/docs/Web/API/setTimeout /ja/docs/Web/API/WorkerGlobalScope/caches /ja/docs/Web/API/caches +/ja/docs/Web/API/XMLHttpRequest/onreadystatechange /ja/docs/Web/API/XMLHttpRequest/readystatechange_event /ja/docs/Web/API/XMLHttpRequest/openRequest /ja/docs/orphaned/Web/API/XMLHttpRequest/openRequest +/ja/docs/Web/API/XMLHttpRequestEventTarget/onabort /ja/docs/Web/API/XMLHttpRequest/abort_event +/ja/docs/Web/API/XMLHttpRequestEventTarget/onerror /ja/docs/Web/API/XMLHttpRequest/error_event +/ja/docs/Web/API/XMLHttpRequestEventTarget/onload /ja/docs/Web/API/XMLHttpRequest/load_event +/ja/docs/Web/API/XMLHttpRequestEventTarget/onloadstart /ja/docs/Web/API/XMLHttpRequest/loadstart_event +/ja/docs/Web/API/XMLHttpRequestEventTarget/onprogress /ja/docs/Web/API/XMLHttpRequest/progress_event /ja/docs/Web/API/XRHandedness /ja/docs/conflicting/Web/API/XRInputSource/handedness /ja/docs/Web/API/XRReferenceSpaceEventInit /ja/docs/Web/API/XRReferenceSpaceEvent/XRReferenceSpaceEvent /ja/docs/Web/API/XRReferenceSpaceEventInit/referenceSpace /ja/docs/Web/API/XRReferenceSpaceEvent/XRReferenceSpaceEvent diff --git a/files/ja/_wikihistory.json b/files/ja/_wikihistory.json index 33a9cebdd5..5898cc2194 100644 --- a/files/ja/_wikihistory.json +++ b/files/ja/_wikihistory.json @@ -25508,10 +25508,9 @@ ] }, "Web/API/XMLHttpRequest/abort_event": { - "modified": "2020-10-15T22:11:45.049Z", + "modified": "2020-10-15T22:32:23.389Z", "contributors": [ - "mfuji09", - "silverskyvicto" + "eltociear" ] }, "Web/API/XMLHttpRequest/channel": { @@ -25522,10 +25521,9 @@ ] }, "Web/API/XMLHttpRequest/error_event": { - "modified": "2020-10-15T22:11:42.787Z", + "modified": "2020-10-15T22:32:26.389Z", "contributors": [ - "mfuji09", - "silverskyvicto" + "eltociear" ] }, "Web/API/XMLHttpRequest/getAllResponseHeaders": { @@ -25541,9 +25539,9 @@ ] }, "Web/API/XMLHttpRequest/load_event": { - "modified": "2020-10-15T22:15:45.232Z", + "modified": "2020-10-15T22:32:23.285Z", "contributors": [ - "mfuji09" + "eltociear" ] }, "Web/API/XMLHttpRequest/loadend_event": { @@ -25553,10 +25551,9 @@ ] }, "Web/API/XMLHttpRequest/loadstart_event": { - "modified": "2020-10-15T22:11:44.150Z", + "modified": "2020-10-15T22:32:27.191Z", "contributors": [ - "mfuji09", - "silverskyvicto" + "eltociear" ] }, "Web/API/XMLHttpRequest/mozAnon": { @@ -25589,13 +25586,6 @@ "silverskyvicto" ] }, - "Web/API/XMLHttpRequest/onreadystatechange": { - "modified": "2020-10-15T22:04:40.093Z", - "contributors": [ - "eltociear", - "mfuji09" - ] - }, "Web/API/XMLHttpRequest/open": { "modified": "2020-10-15T22:03:29.655Z", "contributors": [ @@ -25604,9 +25594,9 @@ ] }, "Web/API/XMLHttpRequest/progress_event": { - "modified": "2020-10-15T22:15:47.580Z", + "modified": "2020-10-15T22:32:24.380Z", "contributors": [ - "mfuji09" + "eltociear" ] }, "Web/API/XMLHttpRequest/readyState": { @@ -25616,6 +25606,13 @@ "Uemmra3" ] }, + "Web/API/XMLHttpRequest/readystatechange_event": { + "modified": "2020-10-15T22:04:40.093Z", + "contributors": [ + "eltociear", + "mfuji09" + ] + }, "Web/API/XMLHttpRequest/response": { "modified": "2020-10-15T22:19:18.297Z", "contributors": [ @@ -25696,36 +25693,6 @@ "mpcjazz" ] }, - "Web/API/XMLHttpRequestEventTarget/onabort": { - "modified": "2020-10-15T22:32:23.389Z", - "contributors": [ - "eltociear" - ] - }, - "Web/API/XMLHttpRequestEventTarget/onerror": { - "modified": "2020-10-15T22:32:26.389Z", - "contributors": [ - "eltociear" - ] - }, - "Web/API/XMLHttpRequestEventTarget/onload": { - "modified": "2020-10-15T22:32:23.285Z", - "contributors": [ - "eltociear" - ] - }, - "Web/API/XMLHttpRequestEventTarget/onloadstart": { - "modified": "2020-10-15T22:32:27.191Z", - "contributors": [ - "eltociear" - ] - }, - "Web/API/XMLHttpRequestEventTarget/onprogress": { - "modified": "2020-10-15T22:32:24.380Z", - "contributors": [ - "eltociear" - ] - }, "Web/API/XMLSerializer": { "modified": "2020-10-15T21:17:59.715Z", "contributors": [ diff --git a/files/ja/web/api/xmlhttprequest/abort_event/index.html b/files/ja/web/api/xmlhttprequest/abort_event/index.html new file mode 100644 index 0000000000..a8a128756c --- /dev/null +++ b/files/ja/web/api/xmlhttprequest/abort_event/index.html @@ -0,0 +1,64 @@ +--- +title: XMLHttpRequestEventTarget.onabort +slug: Web/API/XMLHttpRequest/abort_event +tags: + - API + - Property + - Reference + - Web + - XHMLHttpRequestEventTarget + - イベントハンドラ +translation_of: Web/API/XMLHttpRequestEventTarget/onabort +original_slug: Web/API/XMLHttpRequestEventTarget/onabort +--- +
{{APIRef("XMLHttpRequest")}}
+ +

XMLHttpRequestEventTarget.onabort は、 {{domxref("XMLHttpRequest.abort()")}} 関数が呼ばれたときなどの {{domxref("XMLHttpRequest")}} トランザクションが中止されたときに呼び出される関数です。

+ +

構文

+ +
XMLHttpRequest.onabort = callback;
+ +

+ + + +

+ +
var xmlhttp = new XMLHttpRequest(),
+  method = 'GET',
+  url = 'https://developer.mozilla.org/';
+
+xmlhttp.open(method, url, true);
+xmlhttp.onabort = function () {
+  console.log('** The request was aborted');
+};
+xmlhttp.send();
+//..
+xmlhttp.abort(); // This will invoke our onabort handler above
+
+ +

仕様

+ + + + + + + + + + + + + + +
仕様ステータス備考
{{SpecName('XMLHttpRequest', '#handler-xhr-onabort')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.XMLHttpRequestEventTarget.onabort")}}

diff --git a/files/ja/web/api/xmlhttprequest/error_event/index.html b/files/ja/web/api/xmlhttprequest/error_event/index.html new file mode 100644 index 0000000000..a42c9536e3 --- /dev/null +++ b/files/ja/web/api/xmlhttprequest/error_event/index.html @@ -0,0 +1,62 @@ +--- +title: XMLHttpRequestEventTarget.onerror +slug: Web/API/XMLHttpRequest/error_event +tags: + - API + - Property + - Reference + - Web + - XMLHttpRequestEventTarget + - イベントハンドラ +translation_of: Web/API/XMLHttpRequestEventTarget/onerror +original_slug: Web/API/XMLHttpRequestEventTarget/onerror +--- +
{{APIRef("XMLHttpRequest")}}
+ +

XMLHttpRequestEventTarget.onerror は、エラーの為に {{domxref("XMLHttpRequest")}} トランザクションが失敗した場合に呼び出される関数です。

+ +

構文

+ +
XMLHttpRequest.onerror = callback;
+ +

+ + + +

+ +
var xmlhttp = new XMLHttpRequest(),
+  method = 'GET',
+  url = 'https://developer.mozilla.org/';
+
+xmlhttp.open(method, url, true);
+xmlhttp.onerror = function () {
+  console.log("** An error occurred during the transaction");
+};
+xmlhttp.send();
+
+ +

仕様

+ + + + + + + + + + + + + + +
仕様ステータス備考
{{SpecName('XMLHttpRequest', '#handler-xhr-onerror')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.XMLHttpRequestEventTarget.onerror")}}

diff --git a/files/ja/web/api/xmlhttprequest/load_event/index.html b/files/ja/web/api/xmlhttprequest/load_event/index.html new file mode 100644 index 0000000000..89f566c83a --- /dev/null +++ b/files/ja/web/api/xmlhttprequest/load_event/index.html @@ -0,0 +1,62 @@ +--- +title: XMLHttpRequestEventTarget.onload +slug: Web/API/XMLHttpRequest/load_event +tags: + - API + - Property + - Reference + - Web + - XMLHttpRequestEventTarget + - イベントハンドラ +translation_of: Web/API/XMLHttpRequestEventTarget/onload +original_slug: Web/API/XMLHttpRequestEventTarget/onload +--- +
{{APIRef("XMLHttpRequest")}}
+ +

XMLHttpRequestEventTarget.onload は、 {{domxref("XMLHttpRequest")}} トランザクションが正常に完了した場合に呼び出される関数です。

+ +

構文

+ +
XMLHttpRequest.onload = callback;
+ +

+ + + +

+ +
var xmlhttp = new XMLHttpRequest(),
+  method = 'GET',
+  url = 'https://developer.mozilla.org/';
+
+xmlhttp.open(method, url, true);
+xmlhttp.onload = function () {
+  // Do something with the retrieved data ( found in xmlhttp.response )
+};
+xmlhttp.send();
+
+ +

仕様

+ + + + + + + + + + + + + + +
仕様ステータス備考
{{SpecName('XMLHttpRequest', '#handler-xhr-onload')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.XMLHttpRequestEventTarget.onload")}}

diff --git a/files/ja/web/api/xmlhttprequest/loadstart_event/index.html b/files/ja/web/api/xmlhttprequest/loadstart_event/index.html new file mode 100644 index 0000000000..55e2add3bf --- /dev/null +++ b/files/ja/web/api/xmlhttprequest/loadstart_event/index.html @@ -0,0 +1,62 @@ +--- +title: XMLHttpRequestEventTarget.onloadstart +slug: Web/API/XMLHttpRequest/loadstart_event +tags: + - API + - Property + - Reference + - Web + - XMLHttpRequestEventTarget + - イベントハンドラ +translation_of: Web/API/XMLHttpRequestEventTarget/onloadstart +original_slug: Web/API/XMLHttpRequestEventTarget/onloadstart +--- +
{{APIRef("XMLHttpRequest")}}
+ +

XMLHttpRequestEventTarget.onloadstart は、 {{domxref("XMLHttpRequest")}} トランザクションがデータ転送を開始するときに呼び出される関数です。

+ +

構文

+ +
XMLHttpRequest.onloadstart = callback;
+ +

+ + + +

+ +
var xmlhttp = new XMLHttpRequest(),
+  method = 'GET',
+  url = 'https://developer.mozilla.org/';
+
+xmlhttp.open(method, url, true);
+xmlhttp.onloadstart = function () {
+  console.log("Download underway");
+};
+xmlhttp.send();
+
+ +

仕様

+ + + + + + + + + + + + + + +
仕様ステータス備考
{{SpecName('XMLHttpRequest', '#handler-xhr-onloadstart')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.XMLHttpRequestEventTarget.onloadstart")}}

diff --git a/files/ja/web/api/xmlhttprequest/onreadystatechange/index.md b/files/ja/web/api/xmlhttprequest/onreadystatechange/index.md deleted file mode 100644 index d537c8dd1a..0000000000 --- a/files/ja/web/api/xmlhttprequest/onreadystatechange/index.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: XMLHttpRequest.onreadystatechange -slug: Web/API/XMLHttpRequest/onreadystatechange -tags: - - API - - Event - - ハンドラー - - プロパティ - - リファレンス - - XHR - - XMLHttpRequest -browser-compat: api.XMLHttpRequest.onreadystatechange -translation_of: Web/API/XMLHttpRequest/onreadystatechange ---- -{{APIRef}} - -[イベントハンドラー](/ja/docs/Web/Events/Event_handlers) で、 `readyState` 属性が変化するたびに呼び出されます。コールバックはユーザーインターフェイスのスレッドから呼び出されます。 **`XMLHttpRequest.onreadystatechange`** プロパティは、 {{domxref("XMLHttpRequest/readystatechange_event", "readystatechange")}} イベントが発行されるたびに、つまり {{domxref("XMLHttpRequest")}} の {{domxref("XMLHttpRequest.readyState", "readyState")}} が変化するたびに呼び出されるイベントハンドラーを保持します。 - -> **Warning:** これは同期リクエストで使用してはいけません。また、ネイティブコードから使用してはいけません。 - -## 構文 - -```js -XMLHttpRequest.onreadystatechange = callback; -``` - -### 値 - -- `callback` は `readyState` が変化したときに実行される関数です。 - -## 例 - -```js -const xhr = new XMLHttpRequest(), - method = "GET", - url = "https://developer.mozilla.org/"; - -xhr.open(method, url, true); -xhr.onreadystatechange = function () { -  // ローカルファイルでは、 Mozilla Firefox で成功するとステータスは0になります - if(xhr.readyState === XMLHttpRequest.DONE) { -  var status = xhr.status; - if (status === 0 || (status >= 200 && status < 400)) { -  // リクエストが正常に終了した -  console.log(xhr.responseText); -  } else { - // あらら! リクエストでエラーが発生しました! -  } -  } -}; -xhr.send(); -``` - -## 仕様書 - -{{Specifications}} - -## ブラウザーの互換性 - -{{Compat}} diff --git a/files/ja/web/api/xmlhttprequest/progress_event/index.html b/files/ja/web/api/xmlhttprequest/progress_event/index.html new file mode 100644 index 0000000000..eb32cc0a22 --- /dev/null +++ b/files/ja/web/api/xmlhttprequest/progress_event/index.html @@ -0,0 +1,74 @@ +--- +title: XMLHttpRequestEventTarget.onprogress +slug: Web/API/XMLHttpRequest/progress_event +tags: + - Property + - Reference + - Web + - XHR + - XMLHttpRequestEventTarget + - イベントハンドラ +translation_of: Web/API/XMLHttpRequestEventTarget/onprogress +original_slug: Web/API/XMLHttpRequestEventTarget/onprogress +--- +

{{APIRef("XMLHttpRequest")}}

+ +

XMLHttpRequestEventTarget.onprogress は、正常に成功する前に {{domxref("XMLHttpRequest")}} の情報を定期的に呼び出す関数です。

+ +

構文

+ +
XMLHttpRequest.onprogress = callback;
+ +

+ + + +

イベント

+ + + +
XMLHttpRequest.onprogress = function (event) {
+  event.loaded;
+  event.total;
+};
+ +

+ +
var xmlhttp = new XMLHttpRequest(),
+  method = 'GET',
+  url = 'https://developer.mozilla.org/';
+
+xmlhttp.open(method, url, true);
+xmlhttp.onprogress = function () {
+  //do something
+};
+xmlhttp.send();
+
+ +

仕様

+ + + + + + + + + + + + + + +
仕様備考コメント
{{SpecName('XMLHttpRequest', '#handler-xhr-onload')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.XMLHttpRequestEventTarget.onprogress")}}

diff --git a/files/ja/web/api/xmlhttprequest/readystatechange_event/index.md b/files/ja/web/api/xmlhttprequest/readystatechange_event/index.md new file mode 100644 index 0000000000..7e64081ec6 --- /dev/null +++ b/files/ja/web/api/xmlhttprequest/readystatechange_event/index.md @@ -0,0 +1,61 @@ +--- +title: XMLHttpRequest.onreadystatechange +slug: Web/API/XMLHttpRequest/readystatechange_event +tags: + - API + - Event + - ハンドラー + - プロパティ + - リファレンス + - XHR + - XMLHttpRequest +translation_of: Web/API/XMLHttpRequest/onreadystatechange +original_slug: Web/API/XMLHttpRequest/onreadystatechange +browser-compat: api.XMLHttpRequest.onreadystatechange +--- +{{APIRef}} + +[イベントハンドラー](/ja/docs/Web/Events/Event_handlers) で、 `readyState` 属性が変化するたびに呼び出されます。コールバックはユーザーインターフェイスのスレッドから呼び出されます。 **`XMLHttpRequest.onreadystatechange`** プロパティは、 {{domxref("XMLHttpRequest/readystatechange_event", "readystatechange")}} イベントが発行されるたびに、つまり {{domxref("XMLHttpRequest")}} の {{domxref("XMLHttpRequest.readyState", "readyState")}} が変化するたびに呼び出されるイベントハンドラーを保持します。 + +> **Warning:** これは同期リクエストで使用してはいけません。また、ネイティブコードから使用してはいけません。 + +## 構文 + +```js +XMLHttpRequest.onreadystatechange = callback; +``` + +### 値 + +- `callback` は `readyState` が変化したときに実行される関数です。 + +## 例 + +```js +const xhr = new XMLHttpRequest(), + method = "GET", + url = "https://developer.mozilla.org/"; + +xhr.open(method, url, true); +xhr.onreadystatechange = function () { +  // ローカルファイルでは、 Mozilla Firefox で成功するとステータスは0になります + if(xhr.readyState === XMLHttpRequest.DONE) { +  var status = xhr.status; + if (status === 0 || (status >= 200 && status < 400)) { +  // リクエストが正常に終了した +  console.log(xhr.responseText); +  } else { + // あらら! リクエストでエラーが発生しました! +  } +  } +}; +xhr.send(); +``` + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} diff --git a/files/ja/web/api/xmlhttprequesteventtarget/onabort/index.html b/files/ja/web/api/xmlhttprequesteventtarget/onabort/index.html deleted file mode 100644 index c6a48aa880..0000000000 --- a/files/ja/web/api/xmlhttprequesteventtarget/onabort/index.html +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onabort -slug: Web/API/XMLHttpRequestEventTarget/onabort -tags: - - API - - Property - - Reference - - Web - - XHMLHttpRequestEventTarget - - イベントハンドラ -translation_of: Web/API/XMLHttpRequestEventTarget/onabort ---- -
{{APIRef("XMLHttpRequest")}}
- -

XMLHttpRequestEventTarget.onabort は、 {{domxref("XMLHttpRequest.abort()")}} 関数が呼ばれたときなどの {{domxref("XMLHttpRequest")}} トランザクションが中止されたときに呼び出される関数です。

- -

構文

- -
XMLHttpRequest.onabort = callback;
- -

- - - -

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onabort = function () {
-  console.log('** The request was aborted');
-};
-xmlhttp.send();
-//..
-xmlhttp.abort(); // This will invoke our onabort handler above
-
- -

仕様

- - - - - - - - - - - - - - -
仕様ステータス備考
{{SpecName('XMLHttpRequest', '#handler-xhr-onabort')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

ブラウザーの互換性

- - - -

{{Compat("api.XMLHttpRequestEventTarget.onabort")}}

diff --git a/files/ja/web/api/xmlhttprequesteventtarget/onerror/index.html b/files/ja/web/api/xmlhttprequesteventtarget/onerror/index.html deleted file mode 100644 index 0735301636..0000000000 --- a/files/ja/web/api/xmlhttprequesteventtarget/onerror/index.html +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onerror -slug: Web/API/XMLHttpRequestEventTarget/onerror -tags: - - API - - Property - - Reference - - Web - - XMLHttpRequestEventTarget - - イベントハンドラ -translation_of: Web/API/XMLHttpRequestEventTarget/onerror ---- -
{{APIRef("XMLHttpRequest")}}
- -

XMLHttpRequestEventTarget.onerror は、エラーの為に {{domxref("XMLHttpRequest")}} トランザクションが失敗した場合に呼び出される関数です。

- -

構文

- -
XMLHttpRequest.onerror = callback;
- -

- - - -

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onerror = function () {
-  console.log("** An error occurred during the transaction");
-};
-xmlhttp.send();
-
- -

仕様

- - - - - - - - - - - - - - -
仕様ステータス備考
{{SpecName('XMLHttpRequest', '#handler-xhr-onerror')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

ブラウザーの互換性

- - - -

{{Compat("api.XMLHttpRequestEventTarget.onerror")}}

diff --git a/files/ja/web/api/xmlhttprequesteventtarget/onload/index.html b/files/ja/web/api/xmlhttprequesteventtarget/onload/index.html deleted file mode 100644 index f208d27499..0000000000 --- a/files/ja/web/api/xmlhttprequesteventtarget/onload/index.html +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onload -slug: Web/API/XMLHttpRequestEventTarget/onload -tags: - - API - - Property - - Reference - - Web - - XMLHttpRequestEventTarget - - イベントハンドラ -translation_of: Web/API/XMLHttpRequestEventTarget/onload ---- -
{{APIRef("XMLHttpRequest")}}
- -

XMLHttpRequestEventTarget.onload は、 {{domxref("XMLHttpRequest")}} トランザクションが正常に完了した場合に呼び出される関数です。

- -

構文

- -
XMLHttpRequest.onload = callback;
- -

- - - -

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onload = function () {
-  // Do something with the retrieved data ( found in xmlhttp.response )
-};
-xmlhttp.send();
-
- -

仕様

- - - - - - - - - - - - - - -
仕様ステータス備考
{{SpecName('XMLHttpRequest', '#handler-xhr-onload')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

ブラウザーの互換性

- - - -

{{Compat("api.XMLHttpRequestEventTarget.onload")}}

diff --git a/files/ja/web/api/xmlhttprequesteventtarget/onloadstart/index.html b/files/ja/web/api/xmlhttprequesteventtarget/onloadstart/index.html deleted file mode 100644 index 606959a180..0000000000 --- a/files/ja/web/api/xmlhttprequesteventtarget/onloadstart/index.html +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onloadstart -slug: Web/API/XMLHttpRequestEventTarget/onloadstart -tags: - - API - - Property - - Reference - - Web - - XMLHttpRequestEventTarget - - イベントハンドラ -translation_of: Web/API/XMLHttpRequestEventTarget/onloadstart ---- -
{{APIRef("XMLHttpRequest")}}
- -

XMLHttpRequestEventTarget.onloadstart は、 {{domxref("XMLHttpRequest")}} トランザクションがデータ転送を開始するときに呼び出される関数です。

- -

構文

- -
XMLHttpRequest.onloadstart = callback;
- -

- - - -

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onloadstart = function () {
-  console.log("Download underway");
-};
-xmlhttp.send();
-
- -

仕様

- - - - - - - - - - - - - - -
仕様ステータス備考
{{SpecName('XMLHttpRequest', '#handler-xhr-onloadstart')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

ブラウザーの互換性

- - - -

{{Compat("api.XMLHttpRequestEventTarget.onloadstart")}}

diff --git a/files/ja/web/api/xmlhttprequesteventtarget/onprogress/index.html b/files/ja/web/api/xmlhttprequesteventtarget/onprogress/index.html deleted file mode 100644 index 7973898e1f..0000000000 --- a/files/ja/web/api/xmlhttprequesteventtarget/onprogress/index.html +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onprogress -slug: Web/API/XMLHttpRequestEventTarget/onprogress -tags: - - Property - - Reference - - Web - - XHR - - XMLHttpRequestEventTarget - - イベントハンドラ -translation_of: Web/API/XMLHttpRequestEventTarget/onprogress ---- -

{{APIRef("XMLHttpRequest")}}

- -

XMLHttpRequestEventTarget.onprogress は、正常に成功する前に {{domxref("XMLHttpRequest")}} の情報を定期的に呼び出す関数です。

- -

構文

- -
XMLHttpRequest.onprogress = callback;
- -

- - - -

イベント

- - - -
XMLHttpRequest.onprogress = function (event) {
-  event.loaded;
-  event.total;
-};
- -

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onprogress = function () {
-  //do something
-};
-xmlhttp.send();
-
- -

仕様

- - - - - - - - - - - - - - -
仕様備考コメント
{{SpecName('XMLHttpRequest', '#handler-xhr-onload')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

ブラウザーの互換性

- - - -

{{Compat("api.XMLHttpRequestEventTarget.onprogress")}}

diff --git a/files/pt-br/_redirects.txt b/files/pt-br/_redirects.txt index 82705e2d46..0c27857616 100644 --- a/files/pt-br/_redirects.txt +++ b/files/pt-br/_redirects.txt @@ -553,6 +553,7 @@ /pt-BR/docs/Web/API/WindowTimers/clearTimeout /pt-BR/docs/Web/API/clearTimeout /pt-BR/docs/Web/API/XMLHttpRequest/Requisicoes_sincronas_e_assincronas /pt-BR/docs/Web/API/XMLHttpRequest/Synchronous_and_Asynchronous_Requests /pt-BR/docs/Web/API/XMLHttpRequest/Usando_XMLHttpRequest /pt-BR/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest +/pt-BR/docs/Web/API/XMLHttpRequest/onreadystatechange /pt-BR/docs/Web/API/XMLHttpRequest/readystatechange_event /pt-BR/docs/Web/API/document.getElementById /pt-BR/docs/Web/API/Document/getElementById /pt-BR/docs/Web/API/document.images /pt-BR/docs/Web/API/Document/images /pt-BR/docs/Web/API/document.scripts /pt-BR/docs/Web/API/Document/scripts diff --git a/files/pt-br/_wikihistory.json b/files/pt-br/_wikihistory.json index a742393df3..50e955faf9 100644 --- a/files/pt-br/_wikihistory.json +++ b/files/pt-br/_wikihistory.json @@ -6920,13 +6920,6 @@ "gustavobeavis" ] }, - "Web/API/XMLHttpRequest/onreadystatechange": { - "modified": "2019-03-23T22:16:58.340Z", - "contributors": [ - "brunoczim", - "gustavobeavis" - ] - }, "Web/API/XMLHttpRequest/open": { "modified": "2020-10-15T22:03:41.298Z", "contributors": [ @@ -6941,6 +6934,13 @@ "gustavobeavis" ] }, + "Web/API/XMLHttpRequest/readystatechange_event": { + "modified": "2019-03-23T22:16:58.340Z", + "contributors": [ + "brunoczim", + "gustavobeavis" + ] + }, "Web/API/XMLHttpRequest/send": { "modified": "2020-10-15T22:05:47.894Z", "contributors": [ diff --git a/files/pt-br/web/api/xmlhttprequest/onreadystatechange/index.html b/files/pt-br/web/api/xmlhttprequest/onreadystatechange/index.html deleted file mode 100644 index fa3ca1c707..0000000000 --- a/files/pt-br/web/api/xmlhttprequest/onreadystatechange/index.html +++ /dev/null @@ -1,120 +0,0 @@ ---- -title: XMLHttpRequest.onreadystatechange -slug: Web/API/XMLHttpRequest/onreadystatechange -tags: - - AJAX - - API - - Evento - - Manipulador de eventos - - XHR - - XMLHttpRequest -translation_of: Web/API/XMLHttpRequest/onreadystatechange ---- -
{{APIRef}}
- -

Um EventHandler é chamado sempre que o atributo readyState é modificado. O callback é chamado a partir da interface do usuário. A propriedade XMLHttpRequest.onreadystatechange contém o manipulador de eventos que é chamado quando o evento readystatechange é disparado, ou seja, toda vez que a propriedade {{domxref("XMLHttpRequest.readyState", "readyState")}} do {{domxref("XMLHttpRequest")}} é modificada.

- -
-

Atenção: Isso não deve ser usado com solicitações síncronas e não deve ser usado como código nativo.

-
- -

O evento readystatechange não será chamado quando a XMLHttpRequest request for cancelada pelo método abort().

- -
-

Atualização: Está disparando na última versão de navegadores (Firefox 51.0.1, Opera 43.0.2442.991, Safari 10.0.3 (12602.4.8), Chrome 54.0.2840.71, Edge, IE11). Exemplo aqui - basta recarregar a página algumas vezes.

-
- -

Sitaxe

- -
XMLHttpRequest.onreadystatechange = callback;
- -

Valores

- - - -

Exemplo

- -
var xhr = new XMLHttpRequest(),
-    method = "GET",
-    url = "https://developer.mozilla.org/";
-
-xhr.open(method, url, true);
-xhr.onreadystatechange = function () {
-        if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
-            console.log(xhr.responseText);
-        }
-    };
-xhr.send();
- -

Especificação

- - - - - - - - - - - - - - -
EspecificaçãoStatusComentário
{{SpecName('XMLHttpRequest', '#handler-xhr-onreadystatechange')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

Compatibilidade com navegadores

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(1)}}{{CompatGeckoDesktop(1.0)}}{{CompatIe(7)}}[1]{{CompatVersionUnknown}}{{CompatSafari(1.2)}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}1.0{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
- -

[1] Internet Explorer versão 5 e 6 suportam chamadas ajax usando ActiveXObject().

diff --git a/files/pt-br/web/api/xmlhttprequest/readystatechange_event/index.html b/files/pt-br/web/api/xmlhttprequest/readystatechange_event/index.html new file mode 100644 index 0000000000..da80c1fb7b --- /dev/null +++ b/files/pt-br/web/api/xmlhttprequest/readystatechange_event/index.html @@ -0,0 +1,121 @@ +--- +title: XMLHttpRequest.onreadystatechange +slug: Web/API/XMLHttpRequest/readystatechange_event +tags: + - AJAX + - API + - Evento + - Manipulador de eventos + - XHR + - XMLHttpRequest +translation_of: Web/API/XMLHttpRequest/onreadystatechange +original_slug: Web/API/XMLHttpRequest/onreadystatechange +--- +
{{APIRef}}
+ +

Um EventHandler é chamado sempre que o atributo readyState é modificado. O callback é chamado a partir da interface do usuário. A propriedade XMLHttpRequest.onreadystatechange contém o manipulador de eventos que é chamado quando o evento readystatechange é disparado, ou seja, toda vez que a propriedade {{domxref("XMLHttpRequest.readyState", "readyState")}} do {{domxref("XMLHttpRequest")}} é modificada.

+ +
+

Atenção: Isso não deve ser usado com solicitações síncronas e não deve ser usado como código nativo.

+
+ +

O evento readystatechange não será chamado quando a XMLHttpRequest request for cancelada pelo método abort().

+ +
+

Atualização: Está disparando na última versão de navegadores (Firefox 51.0.1, Opera 43.0.2442.991, Safari 10.0.3 (12602.4.8), Chrome 54.0.2840.71, Edge, IE11). Exemplo aqui - basta recarregar a página algumas vezes.

+
+ +

Sitaxe

+ +
XMLHttpRequest.onreadystatechange = callback;
+ +

Valores

+ + + +

Exemplo

+ +
var xhr = new XMLHttpRequest(),
+    method = "GET",
+    url = "https://developer.mozilla.org/";
+
+xhr.open(method, url, true);
+xhr.onreadystatechange = function () {
+        if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
+            console.log(xhr.responseText);
+        }
+    };
+xhr.send();
+ +

Especificação

+ + + + + + + + + + + + + + +
EspecificaçãoStatusComentário
{{SpecName('XMLHttpRequest', '#handler-xhr-onreadystatechange')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

Compatibilidade com navegadores

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(1)}}{{CompatGeckoDesktop(1.0)}}{{CompatIe(7)}}[1]{{CompatVersionUnknown}}{{CompatSafari(1.2)}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}1.0{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +

[1] Internet Explorer versão 5 e 6 suportam chamadas ajax usando ActiveXObject().

diff --git a/files/ru/_redirects.txt b/files/ru/_redirects.txt index 9befea5197..e7eb0f6a6e 100644 --- a/files/ru/_redirects.txt +++ b/files/ru/_redirects.txt @@ -391,6 +391,7 @@ /ru/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout /ru/docs/Web/API/setTimeout /ru/docs/Web/API/WindowTimers.setTimeout /ru/docs/Web/API/setTimeout /ru/docs/Web/API/WindowTimers/setTimeout /ru/docs/Web/API/setTimeout +/ru/docs/Web/API/XMLHttpRequest/onreadystatechange /ru/docs/Web/API/XMLHttpRequest/readystatechange_event /ru/docs/Web/API/console.timeEnd /ru/docs/Web/API/Console/timeEnd /ru/docs/Web/API/document.activeElement /ru/docs/Web/API/Document/activeElement /ru/docs/Web/API/document.createComment /ru/docs/Web/API/Document/createComment diff --git a/files/ru/_wikihistory.json b/files/ru/_wikihistory.json index cc29c516de..fd690347f2 100644 --- a/files/ru/_wikihistory.json +++ b/files/ru/_wikihistory.json @@ -11721,12 +11721,6 @@ "forestbird" ] }, - "Web/API/XMLHttpRequest/onreadystatechange": { - "modified": "2019-03-23T22:31:10.101Z", - "contributors": [ - "fider" - ] - }, "Web/API/XMLHttpRequest/open": { "modified": "2020-10-15T22:01:52.733Z", "contributors": [ @@ -11745,6 +11739,12 @@ "fider" ] }, + "Web/API/XMLHttpRequest/readystatechange_event": { + "modified": "2019-03-23T22:31:10.101Z", + "contributors": [ + "fider" + ] + }, "Web/API/XMLHttpRequest/response": { "modified": "2020-10-15T22:13:50.836Z", "contributors": [ diff --git a/files/ru/web/api/xmlhttprequest/onreadystatechange/index.html b/files/ru/web/api/xmlhttprequest/onreadystatechange/index.html deleted file mode 100644 index caf3f2eb37..0000000000 --- a/files/ru/web/api/xmlhttprequest/onreadystatechange/index.html +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: XMLHttpRequest.onreadystatechange -slug: Web/API/XMLHttpRequest/onreadystatechange -tags: - - API - - XHR - - XMLHttpRequest - - Обработчик - - Свойство - - Событие - - Ссылка -translation_of: Web/API/XMLHttpRequest/onreadystatechange ---- -
{{APIRef}}
- -

Обработчик события (EventHandler), который вызывается всякий раз, когда изменяется состояние свойства readyState. Свойство XMLHttpRequest.onreadystatechange содержит обработчик события, вызываемый когда происходит событие {{event("readystatechange")}}, всякий раз  когда свойство {{domxref("XMLHttpRequest.readyState", "readyState")}} запроса {{domxref("XMLHttpRequest")}} изменяется. Колбэк-функция запускается из потока пользовательского интерфейса.

- -
-

Внимание: Не должно использоваться при синхронных запросах  и из исходного кода (native code).

-
- -

Событие readystatechange не произойдёт если запрос XMLHttpRequest отменён методом abort().

- -

Синтаксис

- -
XMLHttpRequest.onreadystatechange = callback;
- -

Значение

- - - -

Пример

- -
var xhr = new XMLHttpRequest(),
-    method = "GET",
-    url = "https://developer.mozilla.org/";
-
-xhr.open(method, url, true);
-xhr.onreadystatechange = function () {
-        if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
-            console.log(xhr.responseText);
-        };
-    };
-xhr.send();
- -

Спецификации

- -{{Specifications}} - -

Совместимость браузеров

- -

{{Compat}}

diff --git a/files/ru/web/api/xmlhttprequest/readystatechange_event/index.html b/files/ru/web/api/xmlhttprequest/readystatechange_event/index.html new file mode 100644 index 0000000000..45f5b343a7 --- /dev/null +++ b/files/ru/web/api/xmlhttprequest/readystatechange_event/index.html @@ -0,0 +1,55 @@ +--- +title: XMLHttpRequest.onreadystatechange +slug: Web/API/XMLHttpRequest/readystatechange_event +tags: + - API + - XHR + - XMLHttpRequest + - Обработчик + - Свойство + - Событие + - Ссылка +translation_of: Web/API/XMLHttpRequest/onreadystatechange +original_slug: Web/API/XMLHttpRequest/onreadystatechange +--- +
{{APIRef}}
+ +

Обработчик события (EventHandler), который вызывается всякий раз, когда изменяется состояние свойства readyState. Свойство XMLHttpRequest.onreadystatechange содержит обработчик события, вызываемый когда происходит событие {{event("readystatechange")}}, всякий раз  когда свойство {{domxref("XMLHttpRequest.readyState", "readyState")}} запроса {{domxref("XMLHttpRequest")}} изменяется. Колбэк-функция запускается из потока пользовательского интерфейса.

+ +
+

Внимание: Не должно использоваться при синхронных запросах  и из исходного кода (native code).

+
+ +

Событие readystatechange не произойдёт если запрос XMLHttpRequest отменён методом abort().

+ +

Синтаксис

+ +
XMLHttpRequest.onreadystatechange = callback;
+ +

Значение

+ + + +

Пример

+ +
var xhr = new XMLHttpRequest(),
+    method = "GET",
+    url = "https://developer.mozilla.org/";
+
+xhr.open(method, url, true);
+xhr.onreadystatechange = function () {
+        if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
+            console.log(xhr.responseText);
+        };
+    };
+xhr.send();
+ +

Спецификации

+ +{{Specifications}} + +

Совместимость браузеров

+ +

{{Compat}}

diff --git a/files/zh-cn/_redirects.txt b/files/zh-cn/_redirects.txt index 8ef2f40181..3fa6160c00 100644 --- a/files/zh-cn/_redirects.txt +++ b/files/zh-cn/_redirects.txt @@ -1217,6 +1217,7 @@ /zh-CN/docs/Web/API/APIWwindow.sidebar /zh-CN/docs/Web/API/Window/sidebar /zh-CN/docs/Web/API/AbortSignal/onabort /zh-CN/docs/Web/API/AbortSignal/abort_event /zh-CN/docs/Web/API/AmbientLightSensor/reading /zh-CN/docs/Web/API/AmbientLightSensor/illuminance +/zh-CN/docs/Web/API/Animation/oncancel /zh-CN/docs/Web/API/Animation/cancel_event /zh-CN/docs/Web/API/ArrayBuffer /zh-CN/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer /zh-CN/docs/Web/API/AudioContext/createAnalyser /zh-CN/docs/Web/API/BaseAudioContext/createAnalyser /zh-CN/docs/Web/API/AudioContext/createBiquadFilter /zh-CN/docs/Web/API/BaseAudioContext/createBiquadFilter @@ -1616,6 +1617,12 @@ /zh-CN/docs/Web/API/WindowTimers/clearTimeout /zh-CN/docs/Web/API/clearTimeout /zh-CN/docs/Web/API/XMLDocument.load /zh-CN/docs/Web/API/XMLDocument/load /zh-CN/docs/Web/API/XMLHttpRequest/FormData /zh-CN/docs/Web/API/FormData +/zh-CN/docs/Web/API/XMLHttpRequest/onreadystatechange /zh-CN/docs/Web/API/XMLHttpRequest/readystatechange_event +/zh-CN/docs/Web/API/XMLHttpRequestEventTarget/onabort /zh-CN/docs/conflicting/Web/API/XMLHttpRequest/abort_event +/zh-CN/docs/Web/API/XMLHttpRequestEventTarget/onerror /zh-CN/docs/conflicting/Web/API/XMLHttpRequest/error_event +/zh-CN/docs/Web/API/XMLHttpRequestEventTarget/onload /zh-CN/docs/conflicting/Web/API/XMLHttpRequest/load_event +/zh-CN/docs/Web/API/XMLHttpRequestEventTarget/onloadstart /zh-CN/docs/conflicting/Web/API/XMLHttpRequest/loadstart_event +/zh-CN/docs/Web/API/XMLHttpRequestEventTarget/onprogress /zh-CN/docs/conflicting/Web/API/XMLHttpRequest/progress_event /zh-CN/docs/Web/API/console.dir /zh-CN/docs/Web/API/Console/dir /zh-CN/docs/Web/API/console.group /zh-CN/docs/Web/API/Console/group /zh-CN/docs/Web/API/console.groupCollapsed /zh-CN/docs/Web/API/Console/groupCollapsed diff --git a/files/zh-cn/_wikihistory.json b/files/zh-cn/_wikihistory.json index 0faeae8e06..6cbfab7e35 100644 --- a/files/zh-cn/_wikihistory.json +++ b/files/zh-cn/_wikihistory.json @@ -7500,6 +7500,12 @@ "WhiteMind" ] }, + "Web/API/Animation/cancel_event": { + "modified": "2019-03-23T22:16:25.770Z", + "contributors": [ + "micblo" + ] + }, "Web/API/Animation/currentTime": { "modified": "2019-03-23T22:25:13.728Z", "contributors": [ @@ -7531,12 +7537,6 @@ "jiangbai333" ] }, - "Web/API/Animation/oncancel": { - "modified": "2019-03-23T22:16:25.770Z", - "contributors": [ - "micblo" - ] - }, "Web/API/Animation/play": { "modified": "2020-10-15T22:30:09.446Z", "contributors": [ @@ -24123,15 +24123,6 @@ "tangzhe7" ] }, - "Web/API/XMLHttpRequest/onreadystatechange": { - "modified": "2019-09-24T22:57:24.203Z", - "contributors": [ - "Ende93", - "Koopos", - "Cmen", - "holynewbie" - ] - }, "Web/API/XMLHttpRequest/open": { "modified": "2020-10-16T05:36:39.774Z", "contributors": [ @@ -24167,6 +24158,15 @@ "holynewbie" ] }, + "Web/API/XMLHttpRequest/readystatechange_event": { + "modified": "2019-09-24T22:57:24.203Z", + "contributors": [ + "Ende93", + "Koopos", + "Cmen", + "holynewbie" + ] + }, "Web/API/XMLHttpRequest/response": { "modified": "2020-10-15T21:52:12.557Z", "contributors": [ @@ -24291,37 +24291,6 @@ "rubyisapm" ] }, - "Web/API/XMLHttpRequestEventTarget/onabort": { - "modified": "2020-10-15T22:25:54.233Z", - "contributors": [ - "liushuyu" - ] - }, - "Web/API/XMLHttpRequestEventTarget/onerror": { - "modified": "2020-10-15T22:08:29.854Z", - "contributors": [ - "weiqinl" - ] - }, - "Web/API/XMLHttpRequestEventTarget/onload": { - "modified": "2020-10-15T22:03:25.613Z", - "contributors": [ - "evestorm" - ] - }, - "Web/API/XMLHttpRequestEventTarget/onloadstart": { - "modified": "2020-10-15T22:09:01.294Z", - "contributors": [ - "luxin88" - ] - }, - "Web/API/XMLHttpRequestEventTarget/onprogress": { - "modified": "2020-10-15T21:53:38.407Z", - "contributors": [ - "liushuyu", - "holynewbie" - ] - }, "Web/API/XMLSerializer": { "modified": "2020-10-15T21:14:45.671Z", "contributors": [ @@ -47327,6 +47296,37 @@ "AlexChao" ] }, + "conflicting/Web/API/XMLHttpRequest/abort_event": { + "modified": "2020-10-15T22:25:54.233Z", + "contributors": [ + "liushuyu" + ] + }, + "conflicting/Web/API/XMLHttpRequest/error_event": { + "modified": "2020-10-15T22:08:29.854Z", + "contributors": [ + "weiqinl" + ] + }, + "conflicting/Web/API/XMLHttpRequest/load_event": { + "modified": "2020-10-15T22:03:25.613Z", + "contributors": [ + "evestorm" + ] + }, + "conflicting/Web/API/XMLHttpRequest/loadstart_event": { + "modified": "2020-10-15T22:09:01.294Z", + "contributors": [ + "luxin88" + ] + }, + "conflicting/Web/API/XMLHttpRequest/progress_event": { + "modified": "2020-10-15T21:53:38.407Z", + "contributors": [ + "liushuyu", + "holynewbie" + ] + }, "conflicting/Web/API/caches": { "modified": "2020-10-28T03:25:10.149Z", "contributors": [ diff --git a/files/zh-cn/conflicting/web/api/xmlhttprequest/abort_event/index.html b/files/zh-cn/conflicting/web/api/xmlhttprequest/abort_event/index.html new file mode 100644 index 0000000000..289050d88b --- /dev/null +++ b/files/zh-cn/conflicting/web/api/xmlhttprequest/abort_event/index.html @@ -0,0 +1,57 @@ +--- +title: XMLHttpRequestEventTarget.onabort +slug: conflicting/Web/API/XMLHttpRequest/abort_event +translation_of: Web/API/XMLHttpRequestEventTarget/onabort +original_slug: Web/API/XMLHttpRequestEventTarget/onabort +--- +
{{APIRef("XMLHttpRequest")}}
+ +

XMLHttpRequestEventTarget.onabort 会在 {{domxref("XMLHttpRequest")}} 交易操作被诸如 {{domxref("XMLHttpRequest.abort()")}} 函数中止时调用。

+ +

语法

+ +
XMLHttpRequest.onabort = callback;
+ +

+ + + +

示例

+ +
var xmlhttp = new XMLHttpRequest(),
+  method = 'GET',
+  url = 'https://developer.mozilla.org/';
+
+xmlhttp.open(method, url, true);
+xmlhttp.onabort = function () {
+  console.log('** 请求被中止');
+};
+xmlhttp.send();
+//..
+xmlhttp.abort(); // 这将会调用我们上面定义的 onabort 回调函数
+
+ +

规范

+ + + + + + + + + + + + + + +
规范状态备注
{{SpecName('XMLHttpRequest', '#handler-xhr-onabort')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

浏览器兼容性

+ + + +

{{Compat("api.XMLHttpRequestEventTarget.onabort")}}

diff --git a/files/zh-cn/conflicting/web/api/xmlhttprequest/error_event/index.html b/files/zh-cn/conflicting/web/api/xmlhttprequest/error_event/index.html new file mode 100644 index 0000000000..2de18d0333 --- /dev/null +++ b/files/zh-cn/conflicting/web/api/xmlhttprequest/error_event/index.html @@ -0,0 +1,61 @@ +--- +title: XMLHttpRequestEventTarget.onerror +slug: conflicting/Web/API/XMLHttpRequest/error_event +tags: + - API + - Event Handler + - XMLHttpRequestEventTarget +translation_of: Web/API/XMLHttpRequestEventTarget/onerror +original_slug: Web/API/XMLHttpRequestEventTarget/onerror +--- +
{{APIRef("XMLHttpRequest")}}
+ +

XMLHttpRequestEventTarget.onerror 是{{domxref("XMLHttpRequest")}} 事务由于错误而失败时调用的函数。

+ +

请注意只有在网络层级出现错误时才会调用此函数。如果错误只出现在应用层(比如发送一个HTTP的错误码),这个方法将不会被调用。

+ +

语法

+ +
XMLHttpRequest.onerror = callback;
+ +

Values

+ + + +

举例

+ +
var xmlhttp = new XMLHttpRequest(),
+  method = 'GET',
+  url = 'https://developer.mozilla.org/';
+
+xmlhttp.open(method, url, true);
+xmlhttp.onerror = function () {
+  console.log("** An error occurred during the transaction");
+};
+xmlhttp.send();
+
+ +

规范

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('XMLHttpRequest', '#handler-xhr-onerror')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

浏览器兼容性

+ + + +

{{Compat("api.XMLHttpRequestEventTarget.onerror")}}

diff --git a/files/zh-cn/conflicting/web/api/xmlhttprequest/load_event/index.html b/files/zh-cn/conflicting/web/api/xmlhttprequest/load_event/index.html new file mode 100644 index 0000000000..f4f1214644 --- /dev/null +++ b/files/zh-cn/conflicting/web/api/xmlhttprequest/load_event/index.html @@ -0,0 +1,55 @@ +--- +title: XMLHttpRequestEventTarget.onload +slug: conflicting/Web/API/XMLHttpRequest/load_event +translation_of: Web/API/XMLHttpRequestEventTarget/onload +original_slug: Web/API/XMLHttpRequestEventTarget/onload +--- +
{{APIRef("XMLHttpRequest")}}
+ +

XMLHttpRequestEventTarget.onload 是 {{domxref("XMLHttpRequest")}} 请求成功完成时调用的函数。

+ +

语法

+ +
XMLHttpRequest.onload = callback;
+ +

+ + + +

示例

+ +
var xmlhttp = new XMLHttpRequest(),
+  method = 'GET',
+  url = 'https://developer.mozilla.org/';
+
+xmlhttp.open(method, url, true);
+xmlhttp.onload = function () {
+  // 处理取回的数据(在 xmlhttp.response 中找到)
+};
+xmlhttp.send();
+
+ +

规范

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('XMLHttpRequest', '#handler-xhr-onload')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

浏览器兼容性

+ + + +

{{Compat("api.XMLHttpRequestEventTarget.onload")}}

diff --git a/files/zh-cn/conflicting/web/api/xmlhttprequest/loadstart_event/index.html b/files/zh-cn/conflicting/web/api/xmlhttprequest/loadstart_event/index.html new file mode 100644 index 0000000000..924d3f94d9 --- /dev/null +++ b/files/zh-cn/conflicting/web/api/xmlhttprequest/loadstart_event/index.html @@ -0,0 +1,55 @@ +--- +title: XMLHttpRequestEventTarget.onloadstart +slug: conflicting/Web/API/XMLHttpRequest/loadstart_event +translation_of: Web/API/XMLHttpRequestEventTarget/onloadstart +original_slug: Web/API/XMLHttpRequestEventTarget/onloadstart +--- +
{{APIRef("XMLHttpRequest")}}
+ +

XMLHttpRequestEventTarget.onloadstart 在{{domxref("XMLHttpRequest")}} 开始传送数据时被调用

+ +

语法

+ +
XMLHttpRequest.onloadstart = callback;
+ +

+ + + +

示例

+ +
var xmlhttp = new XMLHttpRequest(),
+  method = 'GET',
+  url = 'https://developer.mozilla.org/';
+
+xmlhttp.open(method, url, true);
+xmlhttp.onloadstart = function () {
+  console.log("Download underway");
+};
+xmlhttp.send();
+
+ +

规范

+ + + + + + + + + + + + + + +
规范状态说明
{{SpecName('XMLHttpRequest', '#handler-xhr-onloadstart')}}{{Spec2('XMLHttpRequest')}}WHATWG 现存标准
+ +

浏览器兼容性

+ + + +

{{Compat("api.XMLHttpRequestEventTarget.onloadstart")}}

diff --git a/files/zh-cn/conflicting/web/api/xmlhttprequest/progress_event/index.html b/files/zh-cn/conflicting/web/api/xmlhttprequest/progress_event/index.html new file mode 100644 index 0000000000..3640fb9cd9 --- /dev/null +++ b/files/zh-cn/conflicting/web/api/xmlhttprequest/progress_event/index.html @@ -0,0 +1,65 @@ +--- +title: XMLHttpRequestEventTarget.onprogress +slug: conflicting/Web/API/XMLHttpRequest/progress_event +translation_of: Web/API/XMLHttpRequestEventTarget/onprogress +original_slug: Web/API/XMLHttpRequestEventTarget/onprogress +--- +

{{APIRef("XMLHttpRequest")}}

+ +

XMLHttpRequestEventTarget.onprogress 是在 {{domxref("XMLHttpRequest")}} 完成之前周期性调用的函数。

+ +

语法

+ +
XMLHttpRequest.onprogress = callback;
+ +

+ + + +

事件

+ + + +
XMLHttpRequest.onprogress = function (event) {
+  event.loaded;
+  event.total;
+};
+ +

示例

+ +
var xmlhttp = new XMLHttpRequest(),
+  method = 'GET',
+  url = 'https://developer.mozilla.org/';
+
+xmlhttp.open(method, url, true);
+xmlhttp.onprogress = function () {
+  //do something
+};
+xmlhttp.send();
+
+ +

规范

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('XMLHttpRequest', '#handler-xhr-onload')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

浏览器兼容性

+ +

{{Compat("api.XMLHttpRequestEventTarget.onprogress")}}

diff --git a/files/zh-cn/web/api/animation/cancel_event/index.html b/files/zh-cn/web/api/animation/cancel_event/index.html new file mode 100644 index 0000000000..339ac7e40f --- /dev/null +++ b/files/zh-cn/web/api/animation/cancel_event/index.html @@ -0,0 +1,112 @@ +--- +title: Animation.oncancel +slug: Web/API/Animation/cancel_event +tags: + - API + - Animation +translation_of: Web/API/Animation/oncancel +original_slug: Web/API/Animation/oncancel +--- +

{{ SeeCompatTable() }}{{ APIRef("Web Animations") }}

+ +

Web Animations API 的 {{domxref("Animation")}} 接口的 oncancel 属性是 {{event("cancel")}} 事件的事件处理程序。

+ +

当动作从其他状态进入 "idle" 播放状态,例如当动画在结束播放后从元素中移除时,cancel 事件可以 {{domxref("Animation.cancel()")}} 被手动触发。 

+ +
+

在新的动画中,创建一个新的初始的空闲动画不会触发 {{event("cancel")}} 事件。

+
+ +

语法

+ +
var cancelHandler = Animation.oncancel;
+
+Animation.oncancel = cancelHandler;
+ +

+ +

当动画被取消时,这个函数将会被执行。默认是 null 。

+ +

例子

+ +

如果动画被取消,将会从元素中移除它。

+ +
animation.oncancel = animation.effect.target.remove();
+
+ +

标准

+ + + + + + + + + + + + + + +
标准状态备注
{{SpecName('Web Animations', '#dom-animation-oncancel', 'Animation.oncancel' )}}{{Spec2('Web Animations')}}编辑草案中。
+ +

浏览器兼容性

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
功能ChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
基础支持{{CompatChrome(39.0)}}{{CompatGeckoDesktop(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
功能AndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
基础支持{{CompatVersionUnknown}}{{CompatGeckoMobile(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +

[1] Web Animations API 默认在 Firefox Developer Edition 和 Nightly builds 被启用。你可以在设置属性 dom.animations-api.core.enabled 为 true 时在 Beta 和 发行版 开启这个功能,你可以设置为 false 来禁用这个功能。

+ +

参见

+ + diff --git a/files/zh-cn/web/api/animation/oncancel/index.html b/files/zh-cn/web/api/animation/oncancel/index.html deleted file mode 100644 index 00e9b0fc98..0000000000 --- a/files/zh-cn/web/api/animation/oncancel/index.html +++ /dev/null @@ -1,111 +0,0 @@ ---- -title: Animation.oncancel -slug: Web/API/Animation/oncancel -tags: - - API - - Animation -translation_of: Web/API/Animation/oncancel ---- -

{{ SeeCompatTable() }}{{ APIRef("Web Animations") }}

- -

Web Animations API 的 {{domxref("Animation")}} 接口的 oncancel 属性是 {{event("cancel")}} 事件的事件处理程序。

- -

当动作从其他状态进入 "idle" 播放状态,例如当动画在结束播放后从元素中移除时,cancel 事件可以 {{domxref("Animation.cancel()")}} 被手动触发。 

- -
-

在新的动画中,创建一个新的初始的空闲动画不会触发 {{event("cancel")}} 事件。

-
- -

语法

- -
var cancelHandler = Animation.oncancel;
-
-Animation.oncancel = cancelHandler;
- -

- -

当动画被取消时,这个函数将会被执行。默认是 null 。

- -

例子

- -

如果动画被取消,将会从元素中移除它。

- -
animation.oncancel = animation.effect.target.remove();
-
- -

标准

- - - - - - - - - - - - - - -
标准状态备注
{{SpecName('Web Animations', '#dom-animation-oncancel', 'Animation.oncancel' )}}{{Spec2('Web Animations')}}编辑草案中。
- -

浏览器兼容性

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
功能ChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
基础支持{{CompatChrome(39.0)}}{{CompatGeckoDesktop(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - -
功能AndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
基础支持{{CompatVersionUnknown}}{{CompatGeckoMobile(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -

[1] Web Animations API 默认在 Firefox Developer Edition 和 Nightly builds 被启用。你可以在设置属性 dom.animations-api.core.enabled 为 true 时在 Beta 和 发行版 开启这个功能,你可以设置为 false 来禁用这个功能。

- -

参见

- - diff --git a/files/zh-cn/web/api/xmlhttprequest/onreadystatechange/index.html b/files/zh-cn/web/api/xmlhttprequest/onreadystatechange/index.html deleted file mode 100644 index 76bd8c6ccf..0000000000 --- a/files/zh-cn/web/api/xmlhttprequest/onreadystatechange/index.html +++ /dev/null @@ -1,120 +0,0 @@ ---- -title: XMLHttpRequest.onreadystatechange -slug: Web/API/XMLHttpRequest/onreadystatechange -tags: - - XHR - - XMLHttpRequest - - 参考 - - 处理程序 - - 属性 - - 接口 -translation_of: Web/API/XMLHttpRequest/onreadystatechange ---- -
{{APIRef}}
- -

只要 readyState 属性发生变化,就会调用相应的处理函数这个回调函数会被用户线程所调用。XMLHttpRequest.onreadystatechange 会在 {{domxref("XMLHttpRequest")}} 的{{domxref("XMLHttpRequest.readyState", "readyState")}} 属性发生改变时触发 {{event("readystatechange")}} 事件的时候被调用。

- -
-

警告:这个方法不该用于同步的requests对象,并且不能在内部(C++)代码中使用.

-
- -

当一个 XMLHttpRequest 请求被 abort() 方法取消时,其对应的 readystatechange 事件不会被触发。

- -
-

UPDATE: 在下面的浏览器版本中会触发 (Firefox 51.0.1, Opera 43.0.2442.991, Safari 10.0.3 (12602.4.8), Chrome 54.0.2840.71, Edge, IE11). 例子在 here - 重新加载几次页面即可。

-
- -

语法

- -
XMLHttpRequest.onreadystatechange = callback;
- -

取值

- - - -

示例

- -
var xhr= new XMLHttpRequest(),
-    method = "GET",
-    url = "https://developer.mozilla.org/";
-
-xhr.open(method, url, true);
-xhr.onreadystatechange = function () {
-  if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
-    console.log(xhr.responseText)
-  }
-}
-xhr.send();
- -

规范

- - - - - - - - - - - - - - -
规范状态注释
{{SpecName('XMLHttpRequest', '#handler-xhr-onreadystatechange')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

浏览器兼容性

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(1)}}{{CompatGeckoDesktop(1.0)}}{{CompatIe(7)}}[1]{{CompatVersionUnknown}}{{CompatSafari(1.2)}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}1.0{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
- -

[1] IE 5 和 6可以通过使用 ActiveXObject() 支持ajax。

diff --git a/files/zh-cn/web/api/xmlhttprequest/readystatechange_event/index.html b/files/zh-cn/web/api/xmlhttprequest/readystatechange_event/index.html new file mode 100644 index 0000000000..63cdfe5bf8 --- /dev/null +++ b/files/zh-cn/web/api/xmlhttprequest/readystatechange_event/index.html @@ -0,0 +1,121 @@ +--- +title: XMLHttpRequest.onreadystatechange +slug: Web/API/XMLHttpRequest/readystatechange_event +tags: + - XHR + - XMLHttpRequest + - 参考 + - 处理程序 + - 属性 + - 接口 +translation_of: Web/API/XMLHttpRequest/onreadystatechange +original_slug: Web/API/XMLHttpRequest/onreadystatechange +--- +
{{APIRef}}
+ +

只要 readyState 属性发生变化,就会调用相应的处理函数这个回调函数会被用户线程所调用。XMLHttpRequest.onreadystatechange 会在 {{domxref("XMLHttpRequest")}} 的{{domxref("XMLHttpRequest.readyState", "readyState")}} 属性发生改变时触发 {{event("readystatechange")}} 事件的时候被调用。

+ +
+

警告:这个方法不该用于同步的requests对象,并且不能在内部(C++)代码中使用.

+
+ +

当一个 XMLHttpRequest 请求被 abort() 方法取消时,其对应的 readystatechange 事件不会被触发。

+ +
+

UPDATE: 在下面的浏览器版本中会触发 (Firefox 51.0.1, Opera 43.0.2442.991, Safari 10.0.3 (12602.4.8), Chrome 54.0.2840.71, Edge, IE11). 例子在 here - 重新加载几次页面即可。

+
+ +

语法

+ +
XMLHttpRequest.onreadystatechange = callback;
+ +

取值

+ + + +

示例

+ +
var xhr= new XMLHttpRequest(),
+    method = "GET",
+    url = "https://developer.mozilla.org/";
+
+xhr.open(method, url, true);
+xhr.onreadystatechange = function () {
+  if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
+    console.log(xhr.responseText)
+  }
+}
+xhr.send();
+ +

规范

+ + + + + + + + + + + + + + +
规范状态注释
{{SpecName('XMLHttpRequest', '#handler-xhr-onreadystatechange')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

浏览器兼容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(1)}}{{CompatGeckoDesktop(1.0)}}{{CompatIe(7)}}[1]{{CompatVersionUnknown}}{{CompatSafari(1.2)}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}1.0{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +

[1] IE 5 和 6可以通过使用 ActiveXObject() 支持ajax。

diff --git a/files/zh-cn/web/api/xmlhttprequesteventtarget/onabort/index.html b/files/zh-cn/web/api/xmlhttprequesteventtarget/onabort/index.html deleted file mode 100644 index 38d305c1c2..0000000000 --- a/files/zh-cn/web/api/xmlhttprequesteventtarget/onabort/index.html +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onabort -slug: Web/API/XMLHttpRequestEventTarget/onabort -translation_of: Web/API/XMLHttpRequestEventTarget/onabort ---- -
{{APIRef("XMLHttpRequest")}}
- -

XMLHttpRequestEventTarget.onabort 会在 {{domxref("XMLHttpRequest")}} 交易操作被诸如 {{domxref("XMLHttpRequest.abort()")}} 函数中止时调用。

- -

语法

- -
XMLHttpRequest.onabort = callback;
- -

- - - -

示例

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onabort = function () {
-  console.log('** 请求被中止');
-};
-xmlhttp.send();
-//..
-xmlhttp.abort(); // 这将会调用我们上面定义的 onabort 回调函数
-
- -

规范

- - - - - - - - - - - - - - -
规范状态备注
{{SpecName('XMLHttpRequest', '#handler-xhr-onabort')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

浏览器兼容性

- - - -

{{Compat("api.XMLHttpRequestEventTarget.onabort")}}

diff --git a/files/zh-cn/web/api/xmlhttprequesteventtarget/onerror/index.html b/files/zh-cn/web/api/xmlhttprequesteventtarget/onerror/index.html deleted file mode 100644 index 3c604e5026..0000000000 --- a/files/zh-cn/web/api/xmlhttprequesteventtarget/onerror/index.html +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onerror -slug: Web/API/XMLHttpRequestEventTarget/onerror -tags: - - API - - Event Handler - - XMLHttpRequestEventTarget -translation_of: Web/API/XMLHttpRequestEventTarget/onerror ---- -
{{APIRef("XMLHttpRequest")}}
- -

XMLHttpRequestEventTarget.onerror 是{{domxref("XMLHttpRequest")}} 事务由于错误而失败时调用的函数。

- -

请注意只有在网络层级出现错误时才会调用此函数。如果错误只出现在应用层(比如发送一个HTTP的错误码),这个方法将不会被调用。

- -

语法

- -
XMLHttpRequest.onerror = callback;
- -

Values

- - - -

举例

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onerror = function () {
-  console.log("** An error occurred during the transaction");
-};
-xmlhttp.send();
-
- -

规范

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('XMLHttpRequest', '#handler-xhr-onerror')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

浏览器兼容性

- - - -

{{Compat("api.XMLHttpRequestEventTarget.onerror")}}

diff --git a/files/zh-cn/web/api/xmlhttprequesteventtarget/onload/index.html b/files/zh-cn/web/api/xmlhttprequesteventtarget/onload/index.html deleted file mode 100644 index 8e2c27016f..0000000000 --- a/files/zh-cn/web/api/xmlhttprequesteventtarget/onload/index.html +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onload -slug: Web/API/XMLHttpRequestEventTarget/onload -translation_of: Web/API/XMLHttpRequestEventTarget/onload ---- -
{{APIRef("XMLHttpRequest")}}
- -

XMLHttpRequestEventTarget.onload 是 {{domxref("XMLHttpRequest")}} 请求成功完成时调用的函数。

- -

语法

- -
XMLHttpRequest.onload = callback;
- -

- - - -

示例

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onload = function () {
-  // 处理取回的数据(在 xmlhttp.response 中找到)
-};
-xmlhttp.send();
-
- -

规范

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('XMLHttpRequest', '#handler-xhr-onload')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

浏览器兼容性

- - - -

{{Compat("api.XMLHttpRequestEventTarget.onload")}}

diff --git a/files/zh-cn/web/api/xmlhttprequesteventtarget/onloadstart/index.html b/files/zh-cn/web/api/xmlhttprequesteventtarget/onloadstart/index.html deleted file mode 100644 index 1501afd132..0000000000 --- a/files/zh-cn/web/api/xmlhttprequesteventtarget/onloadstart/index.html +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onloadstart -slug: Web/API/XMLHttpRequestEventTarget/onloadstart -translation_of: Web/API/XMLHttpRequestEventTarget/onloadstart ---- -
{{APIRef("XMLHttpRequest")}}
- -

XMLHttpRequestEventTarget.onloadstart 在{{domxref("XMLHttpRequest")}} 开始传送数据时被调用

- -

语法

- -
XMLHttpRequest.onloadstart = callback;
- -

- - - -

示例

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onloadstart = function () {
-  console.log("Download underway");
-};
-xmlhttp.send();
-
- -

规范

- - - - - - - - - - - - - - -
规范状态说明
{{SpecName('XMLHttpRequest', '#handler-xhr-onloadstart')}}{{Spec2('XMLHttpRequest')}}WHATWG 现存标准
- -

浏览器兼容性

- - - -

{{Compat("api.XMLHttpRequestEventTarget.onloadstart")}}

diff --git a/files/zh-cn/web/api/xmlhttprequesteventtarget/onprogress/index.html b/files/zh-cn/web/api/xmlhttprequesteventtarget/onprogress/index.html deleted file mode 100644 index 40641b30a6..0000000000 --- a/files/zh-cn/web/api/xmlhttprequesteventtarget/onprogress/index.html +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onprogress -slug: Web/API/XMLHttpRequestEventTarget/onprogress -translation_of: Web/API/XMLHttpRequestEventTarget/onprogress ---- -

{{APIRef("XMLHttpRequest")}}

- -

XMLHttpRequestEventTarget.onprogress 是在 {{domxref("XMLHttpRequest")}} 完成之前周期性调用的函数。

- -

语法

- -
XMLHttpRequest.onprogress = callback;
- -

- - - -

事件

- - - -
XMLHttpRequest.onprogress = function (event) {
-  event.loaded;
-  event.total;
-};
- -

示例

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onprogress = function () {
-  //do something
-};
-xmlhttp.send();
-
- -

规范

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('XMLHttpRequest', '#handler-xhr-onload')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

浏览器兼容性

- -

{{Compat("api.XMLHttpRequestEventTarget.onprogress")}}

diff --git a/files/zh-tw/_redirects.txt b/files/zh-tw/_redirects.txt index d962490e46..f7508b3a88 100644 --- a/files/zh-tw/_redirects.txt +++ b/files/zh-tw/_redirects.txt @@ -582,6 +582,7 @@ /zh-TW/docs/Web/API/WindowOrWorkerGlobalScope/setInterval /zh-TW/docs/Web/API/setInterval /zh-TW/docs/Web/API/WindowTimers /zh-TW/docs/conflicting/Web/API/WindowOrWorkerGlobalScope_e2691f7ad05781a30c5fc5bb3b3f633a /zh-TW/docs/Web/API/XMLHttpRequest/FormData /zh-TW/docs/Web/API/FormData +/zh-TW/docs/Web/API/XMLHttpRequest/onreadystatechange /zh-TW/docs/Web/API/XMLHttpRequest/readystatechange_event /zh-TW/docs/Web/API/document.createTreeWalker /zh-TW/docs/Web/API/Document/createTreeWalker /zh-TW/docs/Web/API/document.querySelector /zh-TW/docs/Web/API/Document/querySelector /zh-TW/docs/Web/Apps/Progressive /zh-TW/docs/Web/Progressive_web_apps diff --git a/files/zh-tw/_wikihistory.json b/files/zh-tw/_wikihistory.json index d0f838a37b..6ac906774b 100644 --- a/files/zh-tw/_wikihistory.json +++ b/files/zh-tw/_wikihistory.json @@ -4717,12 +4717,6 @@ "ginszme" ] }, - "Web/API/XMLHttpRequest/onreadystatechange": { - "modified": "2019-03-23T22:16:06.897Z", - "contributors": [ - "jackblackevo" - ] - }, "Web/API/XMLHttpRequest/readyState": { "modified": "2019-03-23T22:16:03.865Z", "contributors": [ @@ -4731,6 +4725,12 @@ "ginszme" ] }, + "Web/API/XMLHttpRequest/readystatechange_event": { + "modified": "2019-03-23T22:16:06.897Z", + "contributors": [ + "jackblackevo" + ] + }, "Web/API/XMLHttpRequest/setRequestHeader": { "modified": "2020-10-15T22:28:44.084Z", "contributors": [ diff --git a/files/zh-tw/web/api/xmlhttprequest/onreadystatechange/index.html b/files/zh-tw/web/api/xmlhttprequest/onreadystatechange/index.html deleted file mode 100644 index 817daf0efa..0000000000 --- a/files/zh-tw/web/api/xmlhttprequest/onreadystatechange/index.html +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: XMLHttpRequest.onreadystatechange -slug: Web/API/XMLHttpRequest/onreadystatechange -translation_of: Web/API/XMLHttpRequest/onreadystatechange ---- -
{{APIRef}}
- -

An EventHandler that is called whenever the readyState attribute changes. The callback is called from the user interface thread. The XMLHttpRequest.onreadystatechange property contains the event handler to be called when the {{event("readystatechange")}} event is fired, that is every time the {{domxref("XMLHttpRequest.readyState", "readyState")}} property of the {{domxref("XMLHttpRequest")}} changes.

- -
-

Warning: This should not be used with synchronous requests and must not be used from native code.

-
- -

The readystatechange event will not be fired when an XMLHttpRequest request is cancelled with the abort() method.

- -
-

UPDATE: it's firing in the latest version of browsers (Firefox 51.0.1, Opera 43.0.2442.991, Safari 10.0.3 (12602.4.8), Chrome 54.0.2840.71, Edge, IE11). Example here - just reaload page few times.

-
- -

語法

- -
XMLHttpRequest.onreadystatechange = callback;
- -

- - - -

範例

- -
var xhr = new XMLHttpRequest(),
-    method = "GET",
-    url = "https://developer.mozilla.org/";
-
-xhr.open(method, url, true);
-xhr.onreadystatechange = function () {
-        if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
-            console.log(xhr.responseText);
-        }
-    };
-xhr.send();
- -

規範

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('XMLHttpRequest', '#handler-xhr-onreadystatechange')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

瀏覽器相容性

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(1)}}{{CompatGeckoDesktop(1.0)}}{{CompatIe(7)}}[1]{{CompatVersionUnknown}}{{CompatSafari(1.2)}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}1.0{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
- -

[1] Internet Explorer version 5 and 6 supported ajax calls using ActiveXObject().

diff --git a/files/zh-tw/web/api/xmlhttprequest/readystatechange_event/index.html b/files/zh-tw/web/api/xmlhttprequest/readystatechange_event/index.html new file mode 100644 index 0000000000..79d776fec6 --- /dev/null +++ b/files/zh-tw/web/api/xmlhttprequest/readystatechange_event/index.html @@ -0,0 +1,114 @@ +--- +title: XMLHttpRequest.onreadystatechange +slug: Web/API/XMLHttpRequest/readystatechange_event +translation_of: Web/API/XMLHttpRequest/onreadystatechange +original_slug: Web/API/XMLHttpRequest/onreadystatechange +--- +
{{APIRef}}
+ +

An EventHandler that is called whenever the readyState attribute changes. The callback is called from the user interface thread. The XMLHttpRequest.onreadystatechange property contains the event handler to be called when the {{event("readystatechange")}} event is fired, that is every time the {{domxref("XMLHttpRequest.readyState", "readyState")}} property of the {{domxref("XMLHttpRequest")}} changes.

+ +
+

Warning: This should not be used with synchronous requests and must not be used from native code.

+
+ +

The readystatechange event will not be fired when an XMLHttpRequest request is cancelled with the abort() method.

+ +
+

UPDATE: it's firing in the latest version of browsers (Firefox 51.0.1, Opera 43.0.2442.991, Safari 10.0.3 (12602.4.8), Chrome 54.0.2840.71, Edge, IE11). Example here - just reaload page few times.

+
+ +

語法

+ +
XMLHttpRequest.onreadystatechange = callback;
+ +

+ + + +

範例

+ +
var xhr = new XMLHttpRequest(),
+    method = "GET",
+    url = "https://developer.mozilla.org/";
+
+xhr.open(method, url, true);
+xhr.onreadystatechange = function () {
+        if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
+            console.log(xhr.responseText);
+        }
+    };
+xhr.send();
+ +

規範

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('XMLHttpRequest', '#handler-xhr-onreadystatechange')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

瀏覽器相容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(1)}}{{CompatGeckoDesktop(1.0)}}{{CompatIe(7)}}[1]{{CompatVersionUnknown}}{{CompatSafari(1.2)}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}1.0{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +

[1] Internet Explorer version 5 and 6 supported ajax calls using ActiveXObject().

-- cgit v1.2.3-54-g00ecf