<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    
<title>无标题页</title>
   
<script>

var g_blinkid 
= 0;
var g_blinkswitch 
= 0;
var g_blinktitle 
= document.title;
var g_onlineuser 
= "";
var g_sysmsg_sound 
= null;
var g_newmsg_sound 
= null;
var g_app_num 
= 0;
var g_appnum 
= 0;
var g_bappmore 
= false;
var g_inputtime 
= 0;
function blinkNewMsg()
{

 document.title 
= g_blinkswitch % 2==0 ? "【   】 - " + g_blinktitle : "【新消息】 - " + g_blinktitle;
 g_blinkswitch
++;
 


}

 g_blinkid 
= setInterval(blinkNewMsg, 1000);

function stopBlinkNewMsg()
{

    
if (g_blinkid)
    {
        clearInterval(g_blinkid);
        g_blinkid 
= 0;
        document.title 
= g_blinktitle;
    }
}
</script>


</head>
<body>
    
<form id="form1" runat="server">
    
<div>
        
<input id="Button1" type="button" value="button" onclick="stopBlinkNewMsg();" />
    
</div>
    
</form>
</body>
</html>

 

 

参考开心网的head-26.js


var g_blinkid = 0;
var g_blinkswitch = 0;
var g_blinktitle = document.title;
var g_onlineuser = "";
var g_sysmsg_sound = null;
var g_newmsg_sound = null;
var g_app_num = 0;
var g_appnum = 0;
var g_bappmore = false;
var g_inputtime = 0;

function blinkNewMsg()
{
    
var now    = new Date();
    
var nowtime = now.getTime();
    
if(nowtime - g_inputtime > 5000)
    {
        document.title 
= g_blinkswitch % 2 ? "【   】 - " + g_blinktitle : "【新消息】 - " + g_blinktitle;
    }
    
    g_blinkswitch
++;
}

function blinkOnline()
{
    document.title 
= g_blinkswitch % 2 ? "" + g_onlineuser + " 上线了 - " + g_blinktitle : "" + g_onlineuser + " 上线了 - " + g_blinktitle;
    
    g_blinkswitch
++;
    
    
if (g_blinkswitch > 10)
    {
        stopBlinkNewMsg();
    }
}

function checkNewMsg()
{
    
var url = "/home/newmsg.php";
    
var pars = "";
    
var myAjax = new Ajax.Request(url, {method: "post", parameters: pars, onComplete: function (req) { checkNewMsgShow(req); } });
}

function stopBlinkNewMsg()
{
    
if (g_blinkid)
    {
        clearInterval(g_blinkid);
        g_blinkid 
= 0;
        $(
"head_msgdiv").style.display = "none";
        document.title 
= g_blinktitle;
    }
}

var g_oldmsg = g_oldsysmsg = g_oldbbs = g_oldbbsreply = g_oldcomment = g_oldreply = 0;
function checkNewMsgShow(req)
{
    
var r = req.responseText;
    stopBlinkNewMsg();
    setTimeout(checkNewMsg, 
60000);
    
    eval (
"r="+r);

    
var a_msglist = new Array("msg""sysmsg""bbs""bbsreply""comment""reply");
    
if(r.notice == "1")
    {
        
var forbidsound = parseInt(r.forbidsound);
        
if (!forbidsound)
        {
            
for (i=0; i<a_msglist.length; i++)
            {
                
if ($("body_" + a_msglist[i] + "_num"))
                {
                    
var c = parseInt($("body_" + a_msglist[i] + "_num").innerHTML);
                    eval(
"g_old" + a_msglist[i] + "=c;");
                }
            }

            
var newmsg = parseInt(r.msg) + parseInt(r.bbs) + parseInt(r.bbsreply) + parseInt(r.comment) + parseInt(r.reply);
            
var sysmsg = parseInt(r.sysmsg);
            
            
var newchange = (parseInt(r.msg) - g_oldmsg)
                
|| (parseInt(r.bbs) - g_oldbbs)
                
|| (parseInt(r.bbsreply) - g_oldbbsreply)
                
|| (parseInt(r.comment) - g_oldcomment)
                
|| (parseInt(r.reply) - g_oldreply);
            
var syschange = (parseInt(r.sysmsg) - g_oldsysmsg);

            
for (i=0; i<a_msglist.length; i++)
            {
                eval(
"g_old" + a_msglist[i] + "=parseInt(r." + a_msglist[i] + ");");
            }

            
if (newmsg && newchange)
            {
                
if (g_newmsg_sound == null)
                {
                    g_newmsg_sound 
= new SWFObject("http://img.kaixin001.com.cn/i2/newmsg_sound.1.0.swf""newmsg_sound_swf""1""1""8""#ffffff"true);
                    g_newmsg_sound.addParam(
"allowscriptaccess""always");
                    g_newmsg_sound.addParam(
"wmode""opaque");
                    g_newmsg_sound.addParam(
"menu""false");
                    g_newmsg_sound.addVariable(
"autoplay","0");
                }
                g_newmsg_sound.write(
"head_msgsound_div");
            }
            
else if (sysmsg && syschange)
            {
                
if (g_sysmsg_sound == null)
                {
                    g_sysmsg_sound 
= new SWFObject("http://img.kaixin001.com.cn/i2/sysmsg_sound.1.0.swf""sysmsg_sound_swf""1""1""8""#ffffff"true);
                    g_sysmsg_sound.addParam(
"allowscriptaccess""always");
                    g_sysmsg_sound.addParam(
"wmode""opaque");
                    g_sysmsg_sound.addParam(
"menu""false");
                    g_sysmsg_sound.addVariable(
"autoplay","0");
                }
                g_sysmsg_sound.write(
"head_msgsound_div");
            }
        }
        
        $(
"head_msgdiv").style.display = "block";
        g_blinkid 
= setInterval(blinkNewMsg, 1000);
    }
    
else if (0 && r.online.length)
    {
        g_blinkswitch 
= 0;
        g_onlineuser 
= r.online;
        g_blinkid 
= setInterval(blinkOnline, 500);
    }
    
    
for (i=0; i<a_msglist.length; i++)
    {
        
if (!parseInt(r[a_msglist[i]]))
        {
            $(
"head_" + a_msglist[i] + "_num").innerHTML = "";
            
if ($("body_" + a_msglist[i] + "_num"))
            {
                $(
"body_" + a_msglist[i] + "_num").className = "ql2";
                $(
"body_" + a_msglist[i] + "_num").innerHTML = "0条新";
            }
        }
        
else
        {
            $(
"head_" + a_msglist[i] + "_num").innerHTML = "(" + r[a_msglist[i]] + ")";
            
if ($("body_" + a_msglist[i] + "_num"))
            {
                $(
"body_" + a_msglist[i] + "_num").className = "cr";
                $(
"body_" + a_msglist[i] + "_num").innerHTML = r[a_msglist[i]] + "条新";
            }
            
            
if (a_msglist[i] == "msg")
            {
                
if ('function' == typeof(msg_view_checkNewMsg))
                {
                    msg_view_checkNewMsg();
                };
            }
        }
    }
}

function outputHead()
{
    
var v_html = 
'<div >;

    document.writeln(v_html);
}

function _outputApp(v_icon, v_link, v_title, v_aid, v_index_num)
{
    
if (-1 == v_link.indexOf("?"))
    {
        v_link 
+= "?t=" + Math.ceil(Math.random() * 100);
    }
    
else
    {
        v_link 
+= "&t=" + Math.ceil(Math.random() * 100);
    }
    v_html 
= 
'<div style="margin:12px 15px 12px 15px;" onmouseover="javascript:if(\'' + v_index_num + '\'==\'1\'){$(\'app_friend_' + v_aid + '\').style.display=\'block\';}" onmouseout="javascript:$(\'app_friend_' + v_aid + '\').style.display=\'none\';">'
+'    <div class="l"><img src="' + v_icon + '" width="28" height="24" align="absmiddle" /> <a href="' + v_link + '" class="sl" title="' + v_title + '" ><b class="f14">' + v_title + '</b></a></div>'
+'    <div class="l" >;

    
return v_html;
}

function outputApp(v_icon, v_link, v_title, v_aid, v_index_num)
{
    document.writeln(_outputApp(v_icon, v_link, v_title, v_aid, v_index_num));
}

function _setApplistHiddenHead()
{
    
if (g_app_num==-1return '';
    g_appnum
++;
    
if (g_appnum>g_app_num && !g_bappmore)
    {
        g_bappmore 
= true;
        
return '<span id=applistmore style="display:none">';
    }
    
return '';
}

function setApplistHiddenHead()
{
    document.writeln(_setApplistHiddenHead());
}

function _setApplistHiddenTail()
{
    
if (g_app_num==-1return '';
    
if (g_bappmore)
    {
        
return '</span><div id=applistscroll class="tar" style="margin-top:-10px;"><img src="http://img.kaixin001.com.cn/i2/xiala.gif" width="5" align="absmiddle"> <a href="javascript:showAppmore();" class="sl-gray"  style="text-decoration:none;" title="列出我的全部组件">展开</a>&nbsp;&nbsp;</div>';
    }
    
return '';
}

function setApplistHiddenTail()
{
    document.writeln(_setApplistHiddenTail());
}

function outputHead2()
{
    document.write(
'<div class="tac mb5"><img src="http://img.kaixin001.com.cn/i/index_app.gif" width="120" height="2" /></div> <div style="position:relative;"> <div class="install_tips" >);
}

function showAppmore()
{
    
if ($("applistmore").style.display=="none"
    {
        $(
"applistmore").style.display="block";
        $(
"applistscroll").innerHTML = '<img src="http://img.kaixin001.com.cn/i2/shouqi.gif" width="5" align="absmiddle"> <a href="javascript:showAppmore();" class="sl-gray"  style="text-decoration:none;">收起</a>&nbsp;&nbsp;';
    }
    
else
    {
        $(
"applistmore").style.display="none";
        $(
"applistscroll").innerHTML = '<img src="http://img.kaixin001.com.cn/i2/xiala.gif" width="5" align="absmiddle"> <a href="javascript:showAppmore();" class="sl-gray"  style="text-decoration:none;">展开</a>&nbsp;&nbsp;';
    }
}

function outputAppInfo()
{
    
if (g_allapp_num > g_prevapp_num)
    {
        
var url = "/app/left.php";
        
var pars = "";
        
var myAjax = new Ajax.Request(url, {method: "post", parameters: pars, onComplete: function (req) { outputAppInfoAjaxShow(req); } });
    }
}

function outputAppInfoAjaxShow(req)
{
    eval(
"data="+req.responseText);

    
var v_html = '';
    
for (var i=0; i<data.length; i++)
    {
        v_html 
+= _setApplistHiddenHead();
        v_html 
+= _outputApp(data[i]["icon"], data[i]["link"], data[i]["title"], data[i]["aid"], data[i]["index_num"]);
    }
    v_html 
+= _setApplistHiddenTail();
    $(
"head_applist").innerHTML =v_html;
}

function outputTail()
{
    document.writeln(
'<div class="c"></div>'
+'</div>'
+'<div >);
}

相关文章:

  • 2021-10-13
  • 2022-12-23
  • 2022-01-05
  • 2022-03-02
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2022-01-07
猜你喜欢
  • 2021-08-13
  • 2021-10-08
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2022-02-20
  • 2022-01-25
相关资源
相似解决方案