在这里插入代码片
<body bgcolor="#000000">
<script src="./public.js"></script>
<script>
window.onload=function showImg(){
setInterval(createImg,1000);
function createImg(){
var oImg=document.createElement("img");
document.body.appendChild(oImg);
oImg.src="dishu.png";
var w=rand(50,200)
oImg.width=oImg.height=w;
oImg.style.position="absolute";
oImg.style.top=rand(0,window.innerHeight-w)+"px";
oImg.style.left=rand(0,window.innerWidth-w)+"px";
oImg.alt="地鼠";
setTimeout(hide,5000)
function hide(){
document.body.removeChild(oImg)
}
oImg.onclick = function(){
//打掉当前地鼠
this.remove();
}
}
}
</script>
</body>
打地鼠小游戏,比较简陋见谅
最新推荐文章于 2021-05-12 05:53:03 发布