<!DOCTYPE html>
<html>
<head>
<title>页面效果</title>`
<style>
.dv {
display: inline-block;
width: 80px;
height: 80px;
border: 2px solid #000;
border-radius: 5px;
font-size: 25px;
text-align: center;
line-height: 80px;
}
</style>
</head>
<body>
</body>
<script>
var num = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
var a = 0
var js = setInterval(function () {
var div = document.createElement('div');
div.className = 'dv'
div.innerHTML = num[a++]
document.querySelector("body").appendChild(div)
aa()
if (a >= 26) {
clearInterval(js)
}
}, 1000)
function aa() {
var b = document.querySelectorAll('.dv');
var a = Math.floor(Math.random() * b.length);
b[a].style.background = bb()
setTimeout("aa()", 1000);
}
function bb(){
var hex = Math.floor(Math.random() * 16777216).toString(16);
while (hex.length < 6) {
hex = '0' + hex;
}
hex='#'+hex
return hex
}
</script>
</html>