文字滚动特效


点击(此处)折叠或打开

  1. <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
  2. <html xmlns=\"http://www.w3.org/1999/xhtml\">
  3. <head>
  4. <meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />
  5. <title>兼容多个浏览器的文字滚动特效代码-石家庄瑜伽教练培训</title>
  6. <style type=\"text/css\">
  7. .cls_container{border:1px solid #ccc;width:680px;font-size:12px;height:24px;overflow:hidden;}
  8. .cls_container ul{list-style-type:none;margin:0;padding:0;margin-left:32px;}
  9. .cls_container ul li{height:24px;line-height:24px;width:320px;float:left;display:inline;}
  10. </style>
  11. </head>
  12. <body>
  13. <div id=\"myscroll\" class=\"cls_container\">
  14. <ul>
  15. <li><a href=\"http://www.js323.com\">微软和谷歌对浏览器的垄断会导致Web的私有化吗? </a></li>
  16. <li><a href=\"http://www.js323.com\">Subversion高级应用:SVN的多种认证方式</a></li>
  17. <li><a href=\"http://www.js323.com\">年度总结:2008年Java工具</a></li>
  18. <li><a href=\"http://www.js323.com\">要不要把IT主导权还给业务人员? </a></li>
  19. <li><a href=\"http://www.js323.com\">IT专家网08年回顾:开发语言与开发平台共舞 </a></li>
  20. <li><a href=\"http://www.js323.com\">下一代网络业务融合</a></li>
  21. <li><a href=\"http://www.js323.com\">方正科技七大优势 打造全流程专业外包</a></li>
  22. <li><a href=\"http://www.js323.com\">08回顾:Oracle能否继续领跑者数据库市场? </a></li>
  23. <li><a href=\"http://www.js323.com\">Web安全性问题的层次关系分析</a></li>
  24. <li><a href=\"http://www.js323.com\">从融合至存储 以太网成企业网络终极答案</a></li>
  25. </ul>
  26. </div>
  27. <div id=\"showhint\"></div>
  28. <script type=\"text/javascript\">
  29. function $(element){
  30. if(arguments.length>1){
  31. for(var i=0,length=arguments.length,elements=[];i<length;i++){
  32. elements.push($(arguments[i]));
  33. }
  34. return elements;
  35. }
  36. if(typeof element==\"string\"){
  37. return document.getElementById(element);
  38. }else{
  39. return element;
  40. }
  41. }
  42. var Class={
  43. create:function(){
  44. return function(){
  45. this.initialize.apply(this,arguments);
  46. }
  47. }
  48. }
  49. Function.prototype.bind=function(object){
  50. var method=this;
  51. return function(){
  52. method.apply(object,arguments);
  53. }
  54. }
  55. var Scroll=Class.create();
  56. Scroll.prototype={
  57. initialize:function(element,height){
  58. this.element=$(element);
  59. this.element.innerHTML+=this.element.innerHTML;
  60. this.height=height;
  61. this.maxHeight=this.element.scrollHeight/2;
  62. this.counter=0;
  63. this.scroll();
  64. this.timer=\"\";
  65. this.element.onmouseover=this.stop.bind(this);
  66. this.element.onmouseout=function(){this.timer=setTimeout(this.scroll.bind(this),1000);}.bind(this);
  67. },
  68. scroll:function(){
  69. if(this.element.scrollTop<this.maxHeight){
  70. this.element.scrollTop++;
  71. this.counter++;
  72. }else{
  73. this.element.scrollTop=0;
  74. this.counter=0;
  75. }
  76. if(this.counter<this.height){
  77. this.timer=setTimeout(this.scroll.bind(this),20);
  78. }else{
  79. this.counter=0;
  80. this.timer=setTimeout(this.scroll.bind(this),3000);
  81. }
  82. },
  83. stop:function(){
  84. clearTimeout(this.timer);
  85. }
  86. }
  87. var myscroll=new Scroll(\"myscroll\",24);
  88. </script>
  89. </body>
  90. </html>


点击(此处)折叠或打开

  1. <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
  2. <html xmlns=\"http://www.w3.org/1999/xhtml\">
  3. <head>
  4. <meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />
  5. <title>兼容多个浏览器的文字滚动特效代码</title>
  6. <style type=\"text/css\">
  7. .cls_container{border:1px solid #ccc;width:680px;font-size:12px;height:24px;overflow:hidden;}
  8. .cls_container ul{list-style-type:none;margin:0;padding:0;margin-left:32px;}
  9. .cls_container ul li{height:24px;line-height:24px;width:320px;float:left;display:inline;}
  10. </style>
  11. </head>
  12. <body>
  13. <div id=\"myscroll\" class=\"cls_container\">
  14. <ul>
  15. <li><a href=\"http://www.js323.com\">微软和谷歌对浏览器的垄断会导致Web的私有化吗? </a></li>
  16. <li><a href=\"http://www.js323.com\">Subversion高级应用:SVN的多种认证方式</a></li>
  17. <li><a href=\"http://www.js323.com\">年度总结:2008年Java工具</a></li>
  18. <li><a href=\"http://www.js323.com\">要不要把IT主导权还给业务人员? </a></li>
  19. <li><a href=\"http://www.js323.com\">IT专家网08年回顾:开发语言与开发平台共舞 </a></li>
  20. <li><a href=\"http://www.js323.com\">下一代网络业务融合</a></li>
  21. <li><a href=\"http://www.js323.com\">方正科技七大优势 打造全流程专业外包</a></li>
  22. <li><a href=\"http://www.js323.com\">08回顾:Oracle能否继续领跑者数据库市场? </a></li>
  23. <li><a href=\"http://www.js323.com\">Web安全性问题的层次关系分析</a></li>
  24. <li><a href=\"http://www.js323.com\">从融合至存储 以太网成企业网络终极答案</a></li>
  25. </ul>
  26. </div>
  27. <div id=\"showhint\"></div>
  28. <script type=\"text/javascript\">
  29. function $(element){
  30. if(arguments.length>1){
  31. for(var i=0,length=arguments.length,elements=[];i<length;i++){
  32. elements.push($(arguments[i]));
  33. }
  34. return elements;
  35. }
  36. if(typeof element==\"string\"){
  37. return document.getElementById(element);
  38. }else{
  39. return element;
  40. }
  41. }
  42. var Class={
  43. create:function(){
  44. return function(){
  45. this.initialize.apply(this,arguments);
  46. }
  47. }
  48. }
  49. Function.prototype.bind=function(object){
  50. var method=this;
  51. return function(){
  52. method.apply(object,arguments);
  53. }
  54. }
  55. var Scroll=Class.create();
  56. Scroll.prototype={
  57. initialize:function(element,height){
  58. this.element=$(element);
  59. this.element.innerHTML+=this.element.innerHTML;
  60. this.height=height;
  61. this.maxHeight=this.element.scrollHeight/2;
  62. this.counter=0;
  63. this.scroll();
  64. this.timer=\"\";
  65. this.element.onmouseover=this.stop.bind(this);
  66. this.element.onmouseout=function(){this.timer=setTimeout(this.scroll.bind(this),1000);}.bind(this);
  67. },
  68. scroll:function(){
  69. if(this.element.scrollTop<this.maxHeight){
  70. this.element.scrollTop++;
  71. this.counter++;
  72. }else{
  73. this.element.scrollTop=0;
  74. this.counter=0;
  75. }
  76. if(this.counter<this.height){
  77. this.timer=setTimeout(this.scroll.bind(this),20);
  78. }else{
  79. this.counter=0;
  80. this.timer=setTimeout(this.scroll.bind(this),3000);
  81. }
  82. },
  83. stop:function(){
  84. clearTimeout(this.timer);
  85. }
  86. }
  87. var myscroll=new Scroll(\"myscroll\",24);
  88. </script>
  89. </body>
  90. </html>

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29737856/viewspace-1304459/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29737856/viewspace-1304459/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值