The effect of this new message hint is used in the company's project, which is mainly used to prompt the user for new messages. The specific implementation code is as follows:
Copy Code code as follows:
var newmessageremind = {
_step:0,
_title:document.title,
_timer:null,
Show new message Prompts
Show:function () {
var temps = newmessageremind._title.replace ("" "" "" "). Replace (" "New Message" "," ");
Newmessageremind._timer = settimeout (function () {
Newmessageremind.show ();
Write Cookie operation here
newmessageremind._step++;
if (Newmessageremind._step = = 3) {
Newmessageremind._step = 1
};
if (Newmessageremind._step = = 1) {
Document.title = "" "+ Temps
};
if (Newmessageremind._step = = 2) {
Document.title = "" New Message "" + Temps
};
},
800);
return [Newmessageremind._timer, Newmessageremind._title];
},
Cancel New Message prompt
Clear:function () {
Cleartimeout (Newmessageremind._timer);
Document.title = Newmessageremind._title;
Write Cookie operation here
}
};
The call displays a new message prompt: Newmessageremind.show ();
Call cancels new message prompt: Newmessageremind.clear ();
Another: Simple this code will appear this problem:
When you open a site many pages, such as a new message, then all the pages will not stop flashing, when you view the message, other pages will still be prompted.
Our company is solved by the use of cookies, when the new message, all the flashing banner page will be canceled all prompts.