js添加事件处理程序

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>robot</title>
    <script>
        //添加事件处理程序
        //传入三个参数分别为事件名称、处理程序、是否要让事件向上传递
        window.addEventListener("load", init, false);
        function init(){

        }
        //可用removeEventListerer去掉事件处理程序


    </script>
</head>
<body>

</body>
</html>
原文地址:https://www.cnblogs.com/themost/p/9366054.html