欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

javascript如何使页面文字闪烁

程序员文章站 2022-07-14 22:05:32
...
<!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=gb2312" />
<title>无标题文档</title>
<script language="JavaScript">
n=false;  
function flash(txtId){
n=!n;
(n)?(txtId.runtimeStyle.color='blue'):(txtId.runtimeStyle.color='red');
}
</script>
<script>
setInterval(function(){blink.color=blink.color=='#0000ff'?'red':'blue'},100)
</script>

</head>

<body>
<center><br />
<script language="JavaScript">setInterval('flash(blink0)',500)</script>
<font id="blink0" color="blue">闪烁1</font>
<script language="JavaScript">setInterval('flash(blink1)',500)</script>
<font id="blink1" color="blue">闪烁2</font>
<script language="JavaScript">setInterval('flash(blink2)',500)</script>

</body>
</html>