美文网首页
js实例——滚动标题的实现

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

作者: blank的小粉er | 来源:发表于2017-07-20 10:49 被阅读0次
<!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>

相关文章

网友评论

      本文标题:js实例——滚动标题的实现

      本文链接:https://www.haomeiwen.com/subject/bpsdkxtx.html