浏览器闪动效果(标题+内容)

Posted on 2008-11-24 14:12  sky-v  阅读(1466)  评论(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>


 

Copyright © 2024 sky-v
Powered by .NET 8.0 on Kubernetes