比如
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
#root {
display: inline-block;
width: 100px;
height: 100px;
margin: 100px;
background-color: lightblue;
}
</style>
<script type="text/javascript">
window.onload = function () {
const root = document.getElementById("root")
root.addEventListener('mousedown', function (e) {
console.log('mousedown')
})
root.addEventListener('mouseup', function (e) {
console.log('mouseup')
})
console.log('window.onload')
}
</script>
</head>
<body>
<div id="root"></div>
</body>
</html>
此时up无法响应
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…