<!DOCTYPE html>
<html>
<head>
<title>作业</title>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
    
    div{
        width: 100px;
        height: 100px;
        border:1px solid black;
        position: absolute;
        left: 300px;
        top: 200px;
    }
</style>


<script type="text/javascript">
    window.onload=function(){
        
        window.setInterval("show()", 500);
    
    }
    
    function show(){
        
        var left=Math.random()*1000;
        var top=Math.random()*500;
        
        
        document.getElementById("d").style.left=left+"px";
        document.getElementById("d").style.top=top+"px";
    }
</script>

</head>

<body>
    
    <div id="d">
        <img src="1.jpg" width="100" height="100"/>
    </div>
    
</body>
</html>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2022-01-15
  • 2021-12-30
猜你喜欢
  • 2021-09-20
  • 2022-12-23
  • 2021-12-23
  • 2021-11-14
  • 2022-12-23
相关资源
相似解决方案