1//Javascript
2function randomColor(){
3 var color = "#";
4 var randomHex = "123456ABCDEF";
5 for(var i = 0; i<6;i++){
6 color+= randomHex[Math.floor(Math.random()*16)]
7 }
8
9 return color;
10}
11
12var mytimer ;
13
14function setColor(){
15
16 $("body").css("background-color", randomColor);
17}
18
19var mytimer = setInterval(setColor, .8000);
20// html
21!DOCTYPE html>
22<html>
23 <head>
24 <title>Page Title</title>
25 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
26
27 </head>
28 <body>
29
30 //include javascript file.
31 </body>
32</html>
1var colors = ['#ff0000', '#00ff00', '#0000ff'];
2var random_color = colors[Math.floor(Math.random() * colors.length)];
3document.getElementById('title').style.color = random_color;
4