ie标题title闪烁提示
作者:佚名 时间:2013-05-03
var message = {
time: 0,
title: document.title,
timer: null,
// 显示新消息提示
show: function () {
var title = message.title.replace(" ", "").replace("■■新■消■息■■", "");
// 定时器,设置消息切换频率闪烁效果就此产生
message.timer = setTimeout(function () {
message.time++;
message.show();
if (message.time % 2 == 0) {
document.title = "■■新■消■息■■" + title
}
else {
document.title = " " + title
};
}, 600);
return [message.timer, message.title];
},
// 取消新消息提示
clear: function () {
clearTimeout(message.timer);
document.title = message.title;
}
};
调用方法message.show() 关闭方法message.clear();