<%@ Page Language="C#" AutoEventWireup="true" CodeFile="a01.aspx.cs" Inherits="a01" %>

<!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 runat="server">

    <title>yyyyyy</title>

    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>

    <script type="text/javascript">

        var timerArr;

    

        ; (function ($) {

            $.extend({

                /**

                * 调用方法: var timerArr = $.blinkTitle.show();

                *   $.blinkTitle.clear(timerArr);

                */

                blinkTitle: {

                    show: function () { //有新消息时在title处闪烁提示

                        var step = 0, _title = document.title;

                      

                        var timer = setInterval(function () {

                      

                            step++;

                            if (step == 3) { step = 1 };

                            if (step == 1) { document.title = '【   】' + _title };

                            if (step == 2) { document.title = '【新消息】' + _title };

                        }, 500);

                        return [timer, _title];

                    },

                    /**

                    * @param timerArr[0], timer标记

                    * @param timerArr[1], 初始的title文本内容

                    */

                    clear: function (timerArr) { //去除闪烁提示,恢复初始title文本

                        if (timerArr) {

                            clearInterval(timerArr[0]);

                            document.title = timerArr[1];

                        };

                    }

                }

            });

        })(jQuery);

//        jQuery(function ($) {

//            timerArr = $.blinkTitle.show();

//            setTimeout(function () {  //此处是过一定时间后自动消失

//                $.blinkTitle.clear(timerArr);

//            }, 10000);

//            //若人为操作应该消失,只需如此调用: $.blinkTitle.clear(timerArr);

//        });

       

    </script>

    <script type="text/javascript" >

        function Start() {

            //

        

            timerArr = $.blinkTitle.show();

            //

        }

        function End() {

            //

         

            $.blinkTitle.clear(timerArr);

            //

        }

    </script>

</head>

<body>

    <form id="form1" runat="server">

    <div>

    </div>

    </form>

    <p>

        <input id="Button1" type="button" value="开始提示" onclick="Start();" />

        <input id="Button2" type="button" value="关闭提示" onclick="End();" />

    </p>

</body>

</html>


​download​​    ​​demo​