Element.onafterscriptexecute

  • Revision slug: DOM/element.onafterscriptexecute
  • Revision title: element.onafterscriptexecute
  • Revision id: 43947
  • Created:
  • Creator: Midnightaz
  • Is current revision? No
  • Comment Now standardized; 1 words added, 14 words removed

Revision Content

{{ DomRef() }}

{{ gecko_minversion_header("2") }}

Fired when a static {{ HTMLElement("script") }} element  finishes executing its script. Does not fire if the element is added dynamically, eg with appendChild().

Syntax

document.onafterscriptexecute = funcRef;

funcRef is a function reference, called when the event is fired. The event's target attribute is set to the script {{ domxref("Element") }} that just finished executing.

Example

 function finished(e) {
  logMessage("Finished script with ID: " + e.target.id);
}

document.addEventListener("afterscriptexecute", finished, true);

{{ HTMLLiveSample("currentScript.html") }}

See Also

  • {{ domxref("element.onbeforescriptexecute") }}
  • {{ domxref("document.currentScript") }}

Specification

HTML5

Revision Source

<p>{{ DomRef() }}</p>
<p>{{ gecko_minversion_header("2") }}</p>
<p>Fired when a static {{ HTMLElement("script") }} element  finishes executing its script. Does not fire if the element is added dynamically, eg with appendChild().</p>
<h3 class="editable"><span>Syntax </span></h3>
<pre class="eval"><em>document.onafterscriptexecute = funcRef;</em>
</pre>
<p><em>funcRef</em> is a function reference, called when the event is fired. The event's <code>target</code> attribute is set to the script {{ domxref("Element") }} that just finished executing.</p>
<h3 class="editable"><span>Example</span></h3>
<pre class="brush: js"> function finished(e) {
  logMessage("Finished script with ID: " + e.target.id);
}

document.addEventListener("afterscriptexecute", finished, true);
</pre>
<p>{{ HTMLLiveSample("currentScript.html") }}</p>
<h3 class="editable">See Also</h3>
<ul> <li>{{ domxref("element.onbeforescriptexecute") }}</li> <li>{{ domxref("document.currentScript") }}</li>
</ul>
<h3 class="editable"><span>Specification </span></h3>
<p><a class=" external" href="http://www.whatwg.org/specs/web-apps/current-work/#the-script-element" title="http://www.whatwg.org/specs/web-apps/current-work/#the-script-element"><span>HTML5</span></a></p>
Revert to this revision