Skip to content

Website text cycle color changing script code

Original link: https://www.itylq.com/script-for-word-change-color.html

Release date: 2022-10-23 Migration time: 2026-03-21

There are some text that you want to highlight on the website. It is easier to use the text color to automatically change.

javascript code:

<!--Friendly link color changes cyclically-->
<script language="javascript">
function changeColor(){
var color="#f00|#0f0|#00f|#880|#808|#088|yellow|green|blue|gray";
color=color.split("|");
document.getElementById("flinks-color-4").style.color=color[parseInt(Math.random() * color.length)];
document.getElementById("flinks-color-1").style.color=color[parseInt(Math.random() * color.length)];
}
setInterval("changeColor()",500);
</script>

Effect diagram:


This article was moved from WordPress to MkDocs