瀏覽器閃動效果(標題+內容)

Posted on 2008-11-24 14:12 sky-v 閱讀(542) 評論(0) 編輯 收藏

在網易博客上看到的標題閃動效果,感覺挺不錯的。可以在有新消息時候瀏覽器閃動,假如有新消息時,觸發flash_title方法,讓標題閃動。

標題閃動效果代碼:

<HTML>
<HEAD>
<META http-equiv='Content-Type' content='text/html; charset=gb2312'>
<TITLE>標題欄閃爍效果</TITLE>
</HEAD>
<BODY >

<script language="JavaScript">
step=0
function flash_title()
    {
      step++
      if (step==3) {step=1}
      if (step==1) {document.title='【你有新的消息】'}
      if (step==2) {document.title='【      】'}
      setTimeout("flash_title()",380);
    }
flash_title()
</script>

</BODY></HTML>

 

 

內容閃動效果代碼:

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="author" content="">
<SCRIPT>
function blink (elId) {
var html = '';
if (document.all)
html += 'var el = document.all.' + elId + ';';
else if (document.getElementById)
html += 'var el = document.getElementById("' + elId + '");';
html +=
'el.style.visibility = ' +
'el.style.visibility == "hidden" ? "visible" : "hidden"';
if (document.all || document.getElementById)
setInterval(html, 500)
}
function init () {
blink('aText');
blink('a2ndText');
}
</SCRIPT>
<title>
<BLINK>
閃爍效果!!!
</BLINK>
</title>
</HEAD>
<BODY ONLOAD="init();">
<SPAN ID="aText">
<BLINK>
這行文字閃爍!!!
</BLINK>
</SPAN>
<BR>
這行文字閃爍!!!
<DIV ID="a2ndText">
這行文字閃爍!!!
</DIV>
</BODY>
</HTML>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章