js实例——滚动标题的实现

2017-07-20  本文已影响0人  blank的小粉er
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script>

        document.title = "【您有一条新消息】苏州吴彦祖给你留言,他说 你好帅哦,我爱死你了";


        //定时
        setInterval(function(){
            //取 title 中最后一个 字符
            var first_char = document.title[0];
            //取除了第一个剩下的
            var last_string = document.title.substr(1);
            //给title重新赋值
            document.title = last_string + first_char;

        }, 100);
    </script>
</body>
</html>

上一篇 下一篇

猜你喜欢

热点阅读