浏览器标题闪动效果

本文提供了两种实现网页标题和内容闪动效果的方法。一种是通过JavaScript定时改变文档标题达到闪动效果;另一种是利用HTML和JavaScript结合,实现页面上特定文本的可见性切换,从而达到闪动的目的。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文地址:[url]http://www.cnblogs.com/tsgx108/archive/2008/11/24/1339866.html[/url]

[size=medium]标题闪动效果代码:[/size]
<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>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值