js-async-tutorial
js-async-tutorial copied to clipboard
支持事件是同步代码
<!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