zoukankan      html  css  js  c++  java
  • QQ长图

    QQ长图:
                            window.onload=function(){
                                            var oBox=document.getElementById("box");//盒子
                                            var aImg=oBox.getElementsByTagName('img')[0];//图片
                                            var oUp=document.getElementById("up");//向上按钮
                                            var oDown=document.getElementById("down");//向下按钮
                                            var num=0;         //向上向下移动的步码;
                                            var timer=null;
                                            function up(){
                                                    num-=10;
                                                    if(num<=-(aImg.offsetHeight-oBox.offsetHeight)){
                                                            clearInterval(timer);
                                                            num=-(aImg.offsetHeight-oBox.offsetHeight);}    //防止num小于-468,再次移入a中继续移动;
                                                    aImg.style.top=num+'px'; //通过top值来使img运动
                                                }
                                            function down(){
                                                    num+=10;
                                                    if(num>=0){
                                                            clearInterval(timer);
                                                            num=0;}
                                                    aImg.style.top=num+'px';
                                                }
                                            oUp.onmouseover=function(){           //上面按钮点击向上运动
                                                    clearInterval(timer);               //清空定时器,防止继续移入多开定时器
                                                    timer=setInterval(up,60);
                                            }
                                            oUp.onmouseout=function(){
                                                    clearInterval(timer);
                                            }
                                            
                                            oDown.onmouseover=function(){
                                                clearInterval(timer);
                                                timer=setInterval(down,60);
                                            }
                                            oDown.onmouseout=function(){
                                                clearInterval(timer);
                                            }
                                        }

    人生如戏,或实力或演技
  • 相关阅读:
    HDU 2955(01背包问题)
    POJ 2250(LCS最长公共子序列)
    POJ 3356(最短编辑距离问题)
    HDU 1069 Monkey and Banana(LIS最长上升子序列)
    POJ
    HDU 2955(0-1背包问题)
    HDU2602 (0-1背包问题)
    hdu1003 Max Sum(经典dp )
    C题
    D题(贪心)
  • 原文地址:https://www.cnblogs.com/yang0902/p/5698011.html
Copyright © 2011-2022 走看看