• jquer和JS版:网页标题闪烁 title标题闪烁


    jquery版:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>我的文档</title>
    <script type="text/javascript" language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
    <script type="text/javascript" language="javascript">
    $(document).ready(function(){
            title_default = $("title").text() ;
            show = "【新消息】"+title_default ;
            none = "【】"+title_default ;
            i =0 ;
            Flicker() ;
    })
    function Flicker () {
            setInterval("Change()",1000)
    }
    function Change () {
            if(i==0) {
                    $("title").text(show)
                    i = 1 ;
            }
            else {
                    $("title").text(none)
                    i = 0 ;
            }
    }
    </script>
    </head>
    
    <body>
    </body>
    </html>

    JS版:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>我的文档</title>
    <script type="text/javascript" language="javascript">
    Flicker() ;
    var title = document.getElementsByTagName("title") ;
    var title_txt = title[0].firstChild.nodeValue ;
    var show = "【新消息】"+title_txt ;
    var none = "【】"+title_txt ;
    var i = 0 ;
    
    function Flicker () {
            setInterval("Change()",1000)
    }
    function Change () {
            if(i==0) {
                    title[0].firstChild.nodeValue = show ;
                    i = 1 ;
            }
            else {
                    title[0].firstChild.nodeValue = none ;
                    i = 0 ;
            }
    }
    </script>
    </head>
    
    <body>
    </body>
    </html>
  • 相关阅读:
    Leetcode 16.25 LRU缓存 哈希表与双向链表的组合
    Leetcode437 路径总和 III 双递归与前缀和
    leetcode 0404 二叉树检查平衡性 DFS
    Leetcode 1219 黄金矿工 暴力回溯
    Leetcode1218 最长定差子序列 哈希表优化DP
    Leetcode 91 解码方法
    Leetcode 129 求根到叶子节点数字之和 DFS优化
    Leetcode 125 验证回文串 双指针
    Docker安装Mysql记录
    vmware虚拟机---Liunx配置静态IP
  • 原文地址:https://www.cnblogs.com/huanlei/p/2547140.html
Copyright © 2020-2023  润新知