JavaScript設(shè)置瀏覽器標(biāo)題閃動(dòng)
來源:懂視網(wǎng)
責(zé)編:小采
時(shí)間:2020-11-27 20:30:47
JavaScript設(shè)置瀏覽器標(biāo)題閃動(dòng)
JavaScript設(shè)置瀏覽器標(biāo)題閃動(dòng):當(dāng)有新消息或者網(wǎng)頁有Ajax內(nèi)容變動(dòng)時(shí), 可以閃動(dòng)瀏覽器標(biāo)題(或者Tab標(biāo)題), 提示用戶.<script type="text/javascript"><!--function BlinkTitle(title, timeout){ var self = this; var timer
導(dǎo)讀JavaScript設(shè)置瀏覽器標(biāo)題閃動(dòng):當(dāng)有新消息或者網(wǎng)頁有Ajax內(nèi)容變動(dòng)時(shí), 可以閃動(dòng)瀏覽器標(biāo)題(或者Tab標(biāo)題), 提示用戶.<script type="text/javascript"><!--function BlinkTitle(title, timeout){ var self = this; var timer
當(dāng)有新消息或者網(wǎng)頁有Ajax內(nèi)容變動(dòng)時(shí), 可以閃動(dòng)瀏覽器標(biāo)題(或者Tab標(biāo)題), 提示用戶.
<script type="text/javascript">
<!--
function BlinkTitle(title, timeout){
var self = this;
var timer = null;
var backup = document.title;
self.start = function(title, timeout){
self.stop();
if(title != undefined){
self.title = title;
}
self.timeout = timeout == undefined? 600: timeout;
function blink(){
document.title = document.title == backup? self.title : backup;
}
blink();
timer = setInterval(blink, self.timeout);
}
self.stop = function(){
if(timer != null){
document.title = backup;
clearInterval(timer);
timer = null;
}
}
self.start(title, timeout);
}
var blink = new BlinkTitle('12345');
//-->
</script>
<a onclick="blink.stop()">stop</a>
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
JavaScript設(shè)置瀏覽器標(biāo)題閃動(dòng)
JavaScript設(shè)置瀏覽器標(biāo)題閃動(dòng):當(dāng)有新消息或者網(wǎng)頁有Ajax內(nèi)容變動(dòng)時(shí), 可以閃動(dòng)瀏覽器標(biāo)題(或者Tab標(biāo)題), 提示用戶.<script type="text/javascript"><!--function BlinkTitle(title, timeout){ var self = this; var timer