[JS]document.addEventListener

<html>
<body>
<p>使用 addEventListener() 方法来向文档添加点击事件。</p>
<p>点击文档任意处。</p>
<script>
document.addEventListener("click", myFunction('YU','ZHEN'));
document.addEventListener("click", someOtherFunction);

function myFunction(name,name2) {
alert ("Hello World!"+name+name2)
}

function someOtherFunction() {
alert ("该函数同样执行!")
}
</script>
</body>
</html>

原文地址:https://www.cnblogs.com/flyingMonkey/p/5072994.html