就爱编程论坛

标题: JS跑马灯效果 [打印本页]

作者: admin    时间: 2011-8-13 01:50:48     标题: JS跑马灯效果

  1. <html>
  2. <head>
  3. <script type="text/javascript"><!--
  4. function startmarquee(lh,speed,delay) {
  5.     var p=false;
  6.     var t;
  7.     var sh;
  8.     var o=document.getElementById("marqueebox");
  9.     o.innerHTML+=o.innerHTML;
  10.     o.style.marginTop=0;
  11.     o.onmouseover=function(){p=true;}
  12.     o.onmouseout=function(){p=false;}
  13.     function start(){
  14.         sh = o.offsetHeight;
  15.         o.style.height = sh;
  16.         t=setInterval(scrolling,speed);
  17.         if(!p) o.style.marginTop=parseInt(o.style.marginTop)-1+"px";
  18.     }
  19.     function scrolling(){
  20.         if(parseInt(o.style.marginTop)%lh!=0){
  21.             o.style.marginTop=parseInt(o.style.marginTop)-1+"px";
  22.             if(Math.abs(parseInt(o.style.marginTop))>=sh/2) o.style.marginTop=0;
  23.         }else{
  24.             clearInterval(t);
  25.             setTimeout(start,delay);
  26.         }
  27.     }
  28.     setTimeout(start,delay);
  29. }
  30. // --></script>
  31. </head>
  32. <body>
  33. <div style="overflow: hidden; height: 18px; margin-left: 5px;">
  34.     <div id="marqueebox" style="margin-top: -48px; height: 252px;">
  35.         <div class="tp"><a target="_blank" href="http://www.jb51.net" >脚本之家</a></div>
  36.         <div class="tp"><a target="_blank" href="http://s.jb51.net" >服务器常用软件</a></div>
  37.         <div class="tp"><a target="_blank" href="http://www.baidu.com" >百度</a></div>
  38.         <div class="tp"><a target="_blank" href="http://liulanqi.jb51.net">浏览器</a></div>
  39.     </div>

  40. </div>
  41. </body>
  42. <script type="text/javascript"><!--
  43. startmarquee(18,20,3000);
  44. // --></script>
  45. </html>
复制代码


作者: admin    时间: 2011-8-13 01:51:36

  1. <!--Quirks Mode-->
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type"content="text/html; charset=utf-8" />
  6. <title>Fifty Studio│无间断滚动的新闻文章列表</title>
  7. <link rel="stylesheet" type="text/css" href="/tutorials/demo/css/main.css" />
  8. <!--[if IE]><style>
  9. @import url("/tutorials/demo/css/ie.css");
  10. </style><![endif]-->
  11. <style type="text/css">
  12. <!--
  13. a{background:#FFF; color:#333;}
  14. a:hover{background:#FFF;color: #C00;}
  15. #demo ul{text-align: left; }
  16. #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;}
  17. #FGWrapper{width: 400px; margin:2em auto; background:#EEE;}
  18. #demo{overflow:hidden; width: 390px;height: 150px; background:#FFF;margin: 5px;float: left;display: inline;}
  19. #desc{ font-size: 1em; padding:0 10px 10px; clear:both;text-align:left;}
  20. #copyright{float: right;}
  21. -->
  22. </style>
  23. <noscript>
  24. <style type="text/css">
  25. #demo{overflow:auto; }
  26. }
  27. </style>
  28. </noscript>
  29. </head>
  30. <body>
  31. <div id="ForestganWrap">
  32.   <div id="forestganHeader"> <a href="/"><img src="/img/logo.gif" width="170" height="40" alt="Fifty Studio" class="logo" /></a>
  33.     <h1>CSS 布局演示 CSS Layout by Forestgan</h1>
  34.     <h2 id="demo_date">2006-11-1 发表</h2>
  35.   </div>
  36.   <div id="forestganMiddle"> <div id="FGWrapper">

  37. <div id="demo">
  38. <div id="demo1">
  39. <ul>
  40.     <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>
  41.     <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>
  42.     <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=1&id=74" title="未知大小的图片在一个已知大小容器中的水平和垂直居中(二)">未知大小的图片在一个已知大小容器中的水平和垂直居中(二) </a></li>
  43.     <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>
  44.     <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=4&id=72" title="用ASP程序模拟实现first-child的功能">用ASP程序模拟实现first-child的功能 </a></li>
  45.     <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=1&id=71" title="本地检验网页是否符合标准的几种方法">本地检验网页是否符合标准的几种方法 </a></li>
  46.     <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=6&id=70" title="Accessibility和General Developer工具">Accessibility和General Developer工具 </a></li>
  47.     <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=1&id=69" title="未知总宽度的列表菜单水平居中的解决方案">未知总宽度的列表菜单水平居中的解决方案 </a></li>
  48.     <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=4&id=68" title="为机器人程序准备的robots.txt文件">为机器人程序准备的robots.txt文件 </a></li>
  49.     <li><a href="http://www.forest53.com/tutorials/tutorials_show.asp?sortid=1&id=67" title="未知大小图片在已知容器中的垂直和水平居中问题">未知大小图片在已知容器中的垂直和水平居中问题 </a></li>

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

  80. <a href="javascript:history.back()">返回前一页</a>
  81.   </address>
  82. </div>
  83. <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
  84. </script>
  85. <script type="text/javascript">
  86. _uacct = "UA-152060-1";
  87. urchinTracker();
  88. </script>
  89. <noscript>
  90. <p>google-analytics</p>
  91. </noscript>
  92. <script src="/js/copyrightdemo.js" type="text/javascript"></script>
  93. <noscript><p>my stat</p></noscript>

  94. </body>
  95. </html>
复制代码

作者: stevenbeen    时间: 2011-8-13 13:55:58

第一个走马灯 他是一行的滚动 如何变为两行滚动 需要改哪个数字呢?
作者: omhdwep    时间: 2011-9-5 16:58:38

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












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有太多的凄凉只是无力诉说。












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

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












镇远完美国际sf 虞城英雄合击传奇私服 迁安网页设计 屯昌蜀门私服下载 南华魔域服务端 徽县神魔大陆新手卡 射阳天堂2私服




欢迎光临 就爱编程论坛 (http://bbs.waibc.com/) Powered by Discuz! X2