The flashing effect of the title of the page title

Source: Internet
Author: User

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 (); -}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.