浮窗广告html

<!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>

 

posted @ 2014-12-29 23:06  小菜希  阅读(846)  评论(0编辑  收藏  举报