admin 发表于 2011-8-13 01:50:48

JS跑马灯效果

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

admin 发表于 2011-8-13 01:51:36

<!--Quirks Mode-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type"content="text/html; charset=utf-8" />
<title>Fifty Studio│无间断滚动的新闻文章列表</title>
<link rel="stylesheet" type="text/css" href="/tutorials/demo/css/main.css" />
<!--><style>
@import url("/tutorials/demo/css/ie.css");
</style><!-->
<style type="text/css">
<!--
a{background:#FFF; color:#333;}
a:hover{background:#FFF;color: #C00;}
#demo ul{text-align: left; }
#demo li a{line-height:2em; padding-left:1.5em;background: #F7F7F7 url(/img/arrow_l2_over.gif) no-repeat 0 50%;display: block;margin-bottom: 1px;}
#FGWrapper{width: 400px; margin:2em auto; background:#EEE;}
#demo{overflow:hidden; width: 390px;height: 150px; background:#FFF;margin: 5px;float: left;display: inline;}
#desc{ font-size: 1em; padding:0 10px 10px; clear:both;text-align:left;}
#copyright{float: right;}
-->
</style>
<noscript>
<style type="text/css">
#demo{overflow:auto; }
}
</style>
</noscript>
</head>
<body>
<div id="ForestganWrap">
  <div id="forestganHeader"> <a href="/"><img src="/img/logo.gif" width="170" height="40" alt="Fifty Studio" class="logo" /></a>
    <h1>CSS 布局演示 CSS Layout by Forestgan</h1>
    <h2 id="demo_date">2006-11-1 发表</h2>
  </div>
  <div id="forestganMiddle"> <div id="FGWrapper">

<div id="demo">
<div id="demo1">
<ul>
    <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=1&id=76" title="三列自适应宽度液态布局│Three Column Liquid Layouts">三列自适应宽度液态布局│Three Column Liquid Layouts </a></li>
    <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=4&id=75" title="Internet Explorer 7 对CSS的兼容--Box Model Changes">Internet Explorer 7 对CSS的兼容--Box Model Changes </a></li>
    <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=1&id=74" title="未知大小的图片在一个已知大小容器中的水平和垂直居中(二)">未知大小的图片在一个已知大小容器中的水平和垂直居中(二) </a></li>
    <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=4&id=73" title="为不同的浏览器载入不同CSS的二种方法CSS Browser Selector">为不同的浏览器载入不同CSS的二种方法CSS Browser Selector </a></li>
    <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=4&id=72" title="用ASP程序模拟实现first-child的功能">用ASP程序模拟实现first-child的功能 </a></li>
    <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=1&id=71" title="本地检验网页是否符合标准的几种方法">本地检验网页是否符合标准的几种方法 </a></li>
    <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=6&id=70" title="Accessibility和General Developer工具">Accessibility和General Developer工具 </a></li>
    <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=1&id=69" title="未知总宽度的列表菜单水平居中的解决方案">未知总宽度的列表菜单水平居中的解决方案 </a></li>
    <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=4&id=68" title="为机器人程序准备的robots.txt文件">为机器人程序准备的robots.txt文件 </a></li>
    <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=1&id=67" title="未知大小图片在已知容器中的垂直和水平居中问题">未知大小图片在已知容器中的垂直和水平居中问题 </a></li>

</ul>
</div>
<div id="demo2"> </div>
<script type="text/javascript">
    //图片无间断滚动代码,兼容IE、Firefox、Opera
    //原脚本是IE only,来自网上,作者未知
    //部分内容是由forestgan为了JS代码标准化,兼容以gecko为内核的浏览器于2006-10-30重写
    //http://www.forest53.com
    var speed=40;
    var FGDemo=document.getElementById('demo');
    var FGDemo1=document.getElementById('demo1');
    var FGDemo2=document.getElementById('demo2');
    FGDemo2.innerHTML=FGDemo1.innerHTML
    function Marquee1(){
    if(FGDemo2.offsetHeight-FGDemo.scrollTop<=0)
    FGDemo.scrollTop-=FGDemo1.offsetHeight
    else{
    FGDemo.scrollTop++
    }
    }
    var MyMar1=setInterval(Marquee1,speed)
    FGDemo.onmouseover=function() {clearInterval(MyMar1)}
    FGDemo.onmouseout=function() {MyMar1=setInterval(Marquee1,speed)}
</script> </div>
<div id="desc"><a href="http://www.forest53.com"><span id="copyright">Design by Forestgan</span></a>文章列表无间断滚动演示</div>
</div> </div>
</div>
<div id="forestganFooter">
  <address>
  演示页面设计制作: <a href="http://www.forest53.com">Forestgan</a>   采用<a href="http://www.creativecommons.cn/">创作共用授权</a>--署名和非商业用途

<a href="javascript:history.back()">返回前一页</a>
  </address>
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-152060-1";
urchinTracker();
</script>
<noscript>
<p>google-analytics</p>
</noscript>
<script src="/js/copyrightdemo.js" type="text/javascript"></script>
<noscript><p>my stat</p></noscript>

</body>
</html>

stevenbeen 发表于 2011-8-13 13:55:58

{:2_29:}第一个走马灯 他是一行的滚动 如何变为两行滚动 需要改哪个数字呢?{:3_50:}

omhdwep 发表于 2011-9-5 16:58:38

真的牛,双手赞成,谢谢了











static/image/common/sigline.gif
QQ19266677-www.tianhg.com-www.chuanshiqunyingchuanwaigua.com-www.dn5g.com-www.jdcj.net-www.sumitech.net-www.cizuojia.com-www.qqwg520.com-www.djdlwg.com-www.521wgz.com-www.scmxty.com-www.d186.com-www.jasonlife.com-www.bjykj.com-www.yinyi123jxwg.cn-www.51hlf.com-www.bkb8.com-www.qmz20188.com-www.520557.com-代发外链联系QQ19266677

cncus 发表于 2011-10-3 17:32:03

传奇变态私服内蒙古四子王旗136596,七彩万劫小爷唇焦舌敝;钩心斗角|愛兮℡亦吥弃,防患未然传奇私服不能自已,过目成诵n漏网之鱼。k,随机应变1.85传奇私发服。传奇私服万能登陆器2011年新开的嚣张;http://www.244a.comhttp://www.wu96.com今日新开轻变传奇sf‘传奇私服网通发布网小雅发布j夏伤的寂寞翻江倒海。台湾褒忠254780,道士招吕布超绝群伦如今却行同陌路;海不扬波出阁之喜,乖乖灬笨猪~~,乖乖灬懒猪~~给力发布不在恋嗳中失态,爱别人h悲情的歌曲哭泣的聲音。耐得住寂寞雕虫小技,拜鬼求神d有太多的凄凉只是无力诉说。











static/image/common/sigline.gif
http://www.43919.com,http://www.FARENTI.COM传奇私服,
www.39ms.com减肥网,www.71TL.COM天龙八部私服
www.ms19.com魔兽世界私服,www.B5S5.COM左旋肉碱
www.LE76.COM广州开发票,www.WUQIJI.COM奇迹私服
www.04my.com魔域私服,www.zx40.com诛仙私服
www.939a.com小游戏

ABC_84 发表于 2011-10-12 03:02:30

确实不错,眼前一亮的好文











static/image/common/sigline.gif
镇远完美国际sf 虞城英雄合击传奇私服 迁安网页设计 屯昌蜀门私服下载 南华魔域服务端 徽县神魔大陆新手卡 射阳天堂2私服
页: [1]
查看完整版本: JS跑马灯效果