Dom 里定义的onclick怎样传入event事件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/csdnlinyongsheng/article/details/83621653

onclick自带event事件,代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <button onclick="btnFunc()"></button>
    <script>
        function btnFunc()
        {
            var e = window.event || arguments.callee.caller.arguments[0];
            console.log(e);
        }
    </script>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/csdnlinyongsheng/article/details/83621653