zoukankan      html  css  js  c++  java
  • 三俗网站必备之动态广告

    就是一个小方框在整个页面内乱晃内容很黄很暴力的那种

    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style>
        .one{
            width:200px;
            height:220px;
            background-color:#CC3;
            position:absolute;
            top:0px;
            left:0px;   
            cursor:pointer;
        }
    </style>
    <script>
        window.onload = function(){
            var div1= document.getElementsByTagName("div")[0];
            var sx=5,sy=5,x,y;
            var timer = setInterval(startMove,20);
            function startMove(){
                if(document.documentElement.clientWidth - x < div1.offsetWidth || x<0) {
                    sx = -sx;
                }
                if(document.documentElement.clientHeight - y < div1.offsetHeight || y<0){
                    sy = -sy;
                }
                 
                x = div1.offsetLeft + sx;
                y = div1.offsetTop + sy;
                div1.style.left = x +"px";
                div1.style.top = y +"px";           
            }
            div1.onmouseover=function(){
                 
                clearInterval(timer);
                }
                div1.onmouseout=function(){
                    timer = setInterval(startMove,20);
                    }
            div1.onclick=function(){
                document.body.removeChild(div1);
                div1=null;
                }
        }
    </script>
    </head>
      
    <body>
    <div class="one">专治不孕不育阳痿早泄</div>
    </body>
    </html>
  • 相关阅读:
    表单
    html 基础代码
    thread
    流的存入读取
    异常

    Android——多线程编程练习题
    Android——进度对话框
    安卓3个练习题
    Android—对话框
  • 原文地址:https://www.cnblogs.com/zcynine/p/5082474.html
Copyright © 2011-2022 走看看