HTML:
<button onclick="foo(event);">Test</button>
Run Code Online (Sandbox Code Playgroud)
使用Javascript:
window.foo = function(event) {
console.log(JSON.stringify(event));
}
Run Code Online (Sandbox Code Playgroud)
控制台结果:
{"isTrusted":true}
Run Code Online (Sandbox Code Playgroud)
它发生在Chrome上.我还没有测试过其他浏览器.