Don’t ask such a simple question.
In fact, you can also add it to header.asp or footer.asp. But in this way, all the span areas of your entire page will be randomly colored.
Demo
http://www.hljsh.com/tag.asp
The effect is the same. But my demonstration is implemented using asp. What I posted was implemented using JS. The effect is the same.
Copy code The code is as follows:
<script> <br>var obj = document. getElementsByTagName("span"); <br>for(i=0;i<obj.length;i ) <BR>{ <BR>var str = "0123456789abcdef"; <BR>var t = "#"; <BR>for(j=0;j<6;j ) <BR>{t = t str.charAt(Math.random()*str.length);} <BR>obj[i].style.color=t; <BR>} <BR></script>
[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute