js源码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>大小颜色可以变换</title>
</head>
<style>
#show{
color: yellow;
}
</style>
<body>
<div id="show">这是一个艺术字</div>
<script>
var colorSet=document.getElementById("show");
function setColor() {
var num1 = parseInt(Math.random()*256);
var num2 = parseInt(Math.random()*256);
var num3 = parseInt(Math.random()*256);
var num4=parseInt(Math.random()*100);
if (num4==0){
num4=5;
}
var rgb = 'rgb' + '(' + num1 + ',' + num2 + ',' + num3 + ')';
colorSet.style.color= rgb;
var size=num4+"px";
colorSet.style.fontSize=size;
}
setInterval(function () {
setColor()
},500);
</script>
</body>
</html>
结果如下图所示: