document.onreadystatechange

  • Revision slug: DOM/document.onreadystatechange
  • Revision title: document.onreadystatechange
  • Revision id: 94352
  • Created:
  • Creator: Kbrosnan
  • Is current revision? No
  • Comment 1 words added, 1 words removed

Revision Content

{{ DomRef() }}

{{ gecko_minversion_header("2.0") }}

the readystatechange event is fired when document.readyState is changed.

Syntax

document.onreadystatechange = funcRef;

funcRef is a function reference, called when the event is fired.

Example

// alternative to DOMContentLoaded
document.onreadystatechange = function () {
    if (document.readyState == "complete") {
        initApplication();
    }
}

See Also

Specification

Revision Source

<p>{{ DomRef() }}</p>
<p>{{ gecko_minversion_header("2.0") }}</p>
<p>the <strong>readystatechange</strong> event is fired when <code>document.readyState</code> is changed.</p>
<h3 class="editable"><span>Syntax </span></h3>
<pre class="eval"><em>document.onreadystatechange = funcRef;</em>
</pre>
<p><em>funcRef</em> is a function reference, called when the event is fired.</p>
<h3 class="editable"><span>Example</span></h3>
<pre class="brush: js">// alternative to DOMContentLoaded
document.onreadystatechange = function () {
    if (document.readyState == "complete") {
        initApplication();
    }
}
</pre>
<h3 class="editable">See Also</h3>
<ul> <li><a class="internal" href="/en/DOM/document.readyState" title="en/DOM/document.readyState">document.readyState</a></li> <li><a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=300992" title="https://bugzilla.mozilla.org/show_bug.cgi?id=300992">Bug 300992</a> - onreadystatechange (HTML5/Microsoft extension to DOM document) not supported</li>
</ul>
<h3 class="editable"><span>Specification </span></h3>
<ul> <li><a class="external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#current-document-readiness" title="http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#current-document-readiness">http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#current-document-readiness</a></li>
</ul>
Revert to this revision