js-async-tutorial icon indicating copy to clipboard operation
js-async-tutorial copied to clipboard

支持事件是同步代码

Open zhengwei1949 opened this issue 7 years ago • 0 comments

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <input type="button" id="btn" name="" value="">
    <script>
        var oBtn = document.querySelector('#btn');
        oBtn.addEventListener('click',function(){
            console.log(111);
        },false);
        oBtn.click();
        console.log(222);
    </script>
</body>
</html>

打印结果是先打印111,再打印222

zhengwei1949 avatar May 17 '17 19:05 zhengwei1949