首页 > 代码库 > js如何实现网站title的滚动效果

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

            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的滚动效果