It is common for users to be prompted for new messages via the title of the Web page, such as the current microblog and some mailboxes, which are common in this feature.
1 display number of messages:2 <inputtype= "text"ID= "Textmsgs"/>3 <Buttontitle= "Start flashing"onclick= "Flashtitle (' you have ' + document.getElementById (' textmsgs ')." Value + ' new information '); ">Start flashing</Button>4 <Buttontitle= "Stop Flashing"onclick= "Stopflash ();">Stop flashing</Button>
1 varFlashtitleplayer = {2Startfunction(msg) {3 This. title =Document.title;4 if(! This. Action) {5 Try {6 This. Element = document.getElementsByTagName (' title ') [0];7 This. element.innerhtml = This. title;8 This. Action =function(TTL) {9 This. element.innerhtml =ttl;Ten }; One}Catch(e) { A This. Action =function(TTL) { -Document.title =ttl; - } the Delete This. Element; - } - This. Toggletitle =function () { - This. Action (' "' + This. messages[ This. index = This. index = = 0? 1:0] + ' "Come to the blog park! ‘); + }; - } + This. Messages =[MSG]; A varn =msg.length; at vars = '; - if( This. Element) { - varnum = Msg.match (/\w/g); - if(num! =NULL) { - varN2 =num.length; -N-=N2; in while(N2 > 0) { -s + = ""; ton2--; + } - } the } * while(N > 0) { $s + = ";Panax Notoginsengn--; - }; the This. Messages.push (s); + This. index = 0; A This. Timer = SetInterval (function () { the flashtitleplayer.toggletitle (); +}, 1000); - }, $Stopfunction () { $ if( This. Timer) { -Clearinterval ( This. timer); - This. Action ( This. title); the Delete This. Timer; - Delete This. Messages;Wuyi } the } - }; Wu functionFlashtitle (msg) { - Flashtitleplayer.start (msg); About } $ functionStopflash () { - flashtitleplayer.stop (); -}