Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

element.onbeforescriptexecute

概述

当HTML文档中的<script>标签内的代码将要执行时触发该事件,如果这个script标签是用appendChild()等方法动态添加上去的,则不会触发该事件.

语法

document.onbeforescriptexecute = funcRef;

beforescriptexecute事件触发时,funcRef函数就会被调用. 传入参数eventtarget属性指向触发该事件的那个script元素.

例子

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

document.addEventListener("beforescriptexecute", starting, true);

查看在线演示

规范

相关链接

文档标签和贡献者

 此页面的贡献者: ziyunfei, teoli, khalid32, zhangyaochun1987
 最后编辑者: khalid32,