aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/document/beforescriptexecute_event/index.html
diff options
context:
space:
mode:
authorMDN <actions@users.noreply.github.com>2022-02-22 00:12:14 +0000
committerMDN <actions@users.noreply.github.com>2022-02-22 00:12:14 +0000
commit6acf87987baea4675dbd1d5586663959e742cc03 (patch)
tree83b489d9467dc18464207bbec4a8e5eaf9c804cd /files/zh-cn/web/api/document/beforescriptexecute_event/index.html
parent92e543f7c53602f7b0ed8ba0788995632adf9601 (diff)
downloadtranslated-content-6acf87987baea4675dbd1d5586663959e742cc03.tar.gz
translated-content-6acf87987baea4675dbd1d5586663959e742cc03.tar.bz2
translated-content-6acf87987baea4675dbd1d5586663959e742cc03.zip
[CRON] sync translated content
Diffstat (limited to 'files/zh-cn/web/api/document/beforescriptexecute_event/index.html')
-rw-r--r--files/zh-cn/web/api/document/beforescriptexecute_event/index.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/document/beforescriptexecute_event/index.html b/files/zh-cn/web/api/document/beforescriptexecute_event/index.html
new file mode 100644
index 0000000000..1835407a01
--- /dev/null
+++ b/files/zh-cn/web/api/document/beforescriptexecute_event/index.html
@@ -0,0 +1,45 @@
+---
+title: element.onbeforescriptexecute
+slug: Web/API/Document/beforescriptexecute_event
+tags:
+ - DOM
+ - onbeforescriptexecute
+translation_of: Web/API/Document/onbeforescriptexecute
+original_slug: Web/API/Document/onbeforescriptexecute
+---
+<div>{{ApiRef}}{{gecko_minversion_header("2")}}</div>
+
+<h2 id="概述">概述</h2>
+
+<p>当HTML文档中的<code><a class="new" href="../HTML/Element/script" title="&lt;script>">&lt;script&gt;</a></code>标签内的代码将要执行时触发该事件,如果这个<code>script</code>标签是用<code>appendChild()</code>等方法动态添加上去的,则不会触发该事件.</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><em>document.onbeforescriptexecute = funcRef;</em>
+</pre>
+
+<p>当<code>beforescriptexecute</code>事件触发时,<code>funcRef</code>函数就会被调用. 传入参数<code>event</code>的<code>target</code>属性指向触发该事件的那个<code>script</code>元素.</p>
+
+<h2 id="例子">例子</h2>
+
+<pre class="brush: js">function starting(e) {
+ logMessage("Starting script with ID: " + e.target.id);
+}
+
+document.addEventListener("beforescriptexecute", starting, true);
+</pre>
+
+<p><a href="/samples/html/currentScript.html">查看在线演示</a></p>
+
+<h2 id="规范">规范</h2>
+
+<ul>
+ <li><a href="http://www.whatwg.org/specs/web-apps/current-work/#the-script-element">HTML5</a></li>
+</ul>
+
+<h2 id="相关链接">相关链接</h2>
+
+<ul>
+ <li>{{domxref("element.onafterscriptexecute")}}</li>
+ <li>{{domxref("document.currentScript")}}</li>
+</ul>