<html><body><h1>Document 对象</h1><h2>addEventListener() 方法</h2><p>如何为 addEventListener() 方法传参:</p><p>单击文档中的任意位置可执行计算。</p><p id="demo"></p><script>let p1 = 5;let p2 = 7;document.addEventListener("click", function() { myFunction(p1, p2);});function myFunction(a, b) { let result = a * b; document.getElementById("demo").innerHTML = result;}</script></body></html>