Home  >  Article  >  Web Front-end  >  Use html to achieve text flashing effect code

Use html to achieve text flashing effect code

零下一度
零下一度Original
2017-05-03 16:50:379849browse

What is the tag that makes the text flash in the web page? In fact, there is no html tag that can directly make the text flash. You need to use a js script to achieve it.

The code is as follows:

<script language= "javascript " type= "text/javascript ">
function showit()
{
self.setInterval( "changeit() ", 800);
}
function changeit()
{
var bg = &#39;# &#39;;
var color = new Array( "A ", "B ", "C ", "D ", "E ", "F ");
var node = document.getElementById( "con ");//#33FF33
for (var j=1; j <7; j++)
{
var i = Math.round(Math.random()*10);
if (i> =5)
{ bg = bg+color[i-5]; }
else
{ bg = bg + i; }
}
node.style.color = bg;
}
</script>
</HEAD>
<BODY onload= "showit(); ">
<div id= "con " style= "background:#330000;color:#FF3300;width:80px;height:30px;font-size:16pt; "> lasdflasdfhalsdfaldfladhladhlasd </div>
</BODY>
</HTML>

The above is the detailed content of Use html to achieve text flashing effect code. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn