码迷,mamicode.com
首页 > Web开发 > 详细

js如何实现网站title的滚动效果

时间:2017-04-28 13:34:34      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:timeout   定时   字符   str   new   set   cti   substr   滚动   

            var text=document.title;//获得页面的标题
            var timerID;//定时器
            function newtext() {
                clearTimeout(timerID);
                document.title=text.substring(1,text.length)+text.substring(0,1);//截取字符重新赋值给title
                text=document.title.substring(0,text.length);
                timerID = setTimeout("newtext()", 500);
            }
            window.onload=function(){
                newtext();
            };

js如何实现网站title的滚动效果

标签:timeout   定时   字符   str   new   set   cti   substr   滚动   

原文地址:http://www.cnblogs.com/qianzf/p/6780918.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!