<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="700" height="600"
style="border:1px solid #d3d3d3;">
</canvas>
<script>
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
ctx.font = "30px Arial";
setInterval(function() {
ctx.clearRect(0,0,700,600);
for (var index1 = 0; index1 < 20;index1++){
for (var index2 = 0; index2 < 10;index2++){
var num = Math.floor(Math.random() * 10);
var randomColor = Math.floor(Math.random()*16777215).toString(16);
ctx.fillStyle = '#' + randomColor;
ctx.fillText(num,index1*25,index2*35);
}
}
}, 1000);
</script>
</body>
</html>
|