<style>// 内部样式
div{
width:30px;
height:30px;
background: red;
position: absolute;}</style><script>
window.onclick= e =>{let div = document.createElement('div')
div.classList.add('kuang')let x = e.pageX
let y = e. pageY
div.style.left = x +'px'
div.style.top = y +'px'
document.body.appendChild(div)let rnd = Math.round(Math.random())let timer =setInterval(()=>{if(rnd) x -=10else x +=10
y -=5
div.style.left = x +'px'
div.style.top = y +'px'if(y <-100){
div.remove()clearInterval(timer)}},20)}</script>