<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<a href="#" onclick="clearNewMessageRemind();return false;">点击取消闪烁提示</a>
<script>
var newMessageRemind = {
_step: 0,
_title: document.title,
_timer: null,
show: function () {
// newMessageRemind._title始终为无标题文档 replace是没有意义的
var temps = newMessageRemind._title/*.replace("【 】", "").replace("【新消息】", "")*/;
newMessageRemind._timer = setTimeout(function () {
newMessageRemind.show();
newMessageRemind._step++;
if (newMessageRemind._step == 3) {newMessageRemind._step = 1;};
if (newMessageRemind._step == 1) {document.title = "【 】" + temps;};
if (newMessageRemind._step == 2) {document.title = "【新消息】" + temps;};
}, 800);
// 这个return也是没有意义的
/*return [newMessageRemind._timer, newMessageRemind._title];*/
},
clear: function(){
clearTimeout(newMessageRemind._timer);
document.title = newMessageRemind._title;
}
};
newMessageRemind.show();
function clearNewMessageRemind () {
newMessageRemind.clear();
}
</script>
</body>
</html>