Home >Web Front-end >JS Tutorial >Use JS to achieve browser title flashing_javascript skills

Use JS to achieve browser title flashing_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:29:471148browse

The main method is to set a timer through the setTimeout method and switch the message prompt, so as to achieve the flashing of the title and message prompt.

Copy code The code is as follows:



JS effect-browser title bar flashing

                                                                                                                        > timer: null,
// Display new message prompt
show: function () {
var title = message.title.replace("【 】", "").replace("【New message 】", "");
                                                                                                                                                                                                                                                                         ​                message.show( );
IF (MESSAGE.TIME % 2 == 0) {
Document.title = "New Message]" Title
}

Else {
Document.tital = "【  】" title
                                                                                          },
// Cancel new message reminder
clear : function () {
                                                                                                 ();
// Page Bind the click event when loading, click to cancel the flashing prompt
                             



Click the page to cancel the message flashing prompt




Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn