Home >Web Front-end >HTML Tutorial >Use html to achieve text flashing effect code
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 = '# '; 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!