zoukankan      html  css  js  c++  java
  • javascript 文字滚动显示[zhuan ]

    <html> 
    <head> 
    <script type="text/javascript"><!-- 
    function startmarquee(lh,speed,delay) { 
        var p=false; 
        var t; 
        var sh; 
        var o=document.getElementById("marqueebox"); 
        o.innerHTML+=o.innerHTML; 
        o.style.marginTop=0; 
        o.onmouseover=function(){p=true;} 
        o.onmouseout=function(){p=false;} 
        function start(){ 
            sh = o.offsetHeight; 
            o.style.height = sh; 
            t=setInterval(scrolling,speed); 
            if(!p) o.style.marginTop=parseInt(o.style.marginTop)-1+"px"; 
        } 
        function scrolling(){ 
            if(parseInt(o.style.marginTop)%lh!=0){ 
                o.style.marginTop=parseInt(o.style.marginTop)-1+"px"; 
                if(Math.abs(parseInt(o.style.marginTop))>=sh/2) o.style.marginTop=0; 
            }else{ 
                clearInterval(t); 
                setTimeout(start,delay); 
            } 
        } 
        setTimeout(start,delay); 
    // --></script> 
    </head> 
    <body> 
    <div style="overflow: hidden; height: 18px; margin-left: 5px;"> 
        <div id="marqueebox" style="margin-top: -48px; height: 252px;"> 
            <div class="tp"><a target="_blank" href="http://www.jb51.net" >脚本之家</a></div> 
            <div class="tp"><a target="_blank" href="http://s.jb51.net" >服务器常用软件</a></div> 
            <div class="tp"><a target="_blank" href="http://www.baidu.com" >百度</a></div> 
            <div class="tp"><a target="_blank" href="http://liulanqi.jb51.net">浏览器</a></div> 
        </div> 
    </div> 
    </body> 
    <script type="text/javascript"><!-- 
    startmarquee(18,20,3000); 
    // --></script> 
    </html> 
  • 相关阅读:
    二、编写输出“Hello World”
    实验一:JDK下载与安装、Eclipse下载与使用总结心得
    C++引用
    数组类型与sizeof与指针的引用
    电源已接通,未充电
    改变Web Browser控件IE版本
    “stdafx.h”: No such file or directory
    word2013 blog test
    Editplus配置VC++(1) 及相关注意事项
    VC++6.0在Win7以上系统上Open或Add to Project files崩溃问题 解决新办法
  • 原文地址:https://www.cnblogs.com/littleCode/p/3344704.html
Copyright © 2011-2022 走看看