<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
img{position: abso
lute;}
</style>
</head>
<body>
<img src="滑稽.webp" >
<script type="text/javascript">
let img = document.querySelector('img')???????? //獲取img標(biāo)簽
// console.log(img)
document.addEventListener('mousemove',function(e){ //懸浮時(shí)
let x = e.clientX //獲取x軸
let y = e.clientY //獲取y軸
img.style.top = y + 'px' //添加樣式
img.style.left = x + 'px' //添加樣式
})
</script>
</body>
</html>