这是代码:
<script>
document.getElementById('btn').addEventListener('mousedown',(function(){
console.log('code');
}));
</script>
<input id="btn" type="button" onmousedown="console.log('button')">
哪个将首先执行,为什么?
这是代码:
<script>
document.getElementById('btn').addEventListener('mousedown',(function(){
console.log('code');
}));
</script>
<input id="btn" type="button" onmousedown="console.log('button')">
哪个将首先执行,为什么?