<body>
<h1 id="color1" style="margin-top:100px">这里的文字会变颜色哦,blog.tag.gg</h1>
<h1 id="color3" style="margin-top:100px"><a href="https://blog.tag.gg/" target="_blank">这里的文字会变颜色哦,blog.tag.gg</a></h1>
<script>
function randomHexColor() { //随机生成十六进制颜色
return '#' + ('00000' + (Math.random() * 0x1000000 << 0).toString(16)).substr(-6);
}
function color_rand()
{
var color1 = document.getElementById('color1');
var color2 = document.getElementById('color2');
var color3 = document.getElementById('color3');
var color4 = document.getElementById('color4');
var color_href = document.getElementById('color_href');
var color_href2 = document.getElementById('color_href2');
var Interval = setInterval(function(){
color1.style.color = randomHexColor();
color2.style.color = randomHexColor();
var a3 = randomHexColor();
color3.style.color = a3;
color_href.style.color = a3;
var a4 = randomHexColor();
color4.style.color = a4;
color_href2.style.color = a4;
},200);
}
setTimeout('color_rand()',1000);
</script>
</body>
亲爱的:若该文章解决了您的问题,可否收藏+评论+分享呢?
文章评论 本文章有个评论