<div id= "Console" > Online trading Platform Success tips: from Ebay to Yelp to Uber</div><script type= "Text/javascript" >var Consoledom = document.getElementById ("console"); ConsoleDom.style.color = RandomColor1 ();//Get RGB type color IE7 does not support function Randomcolor () {var r = Math.floor (Math.random () *256), var g = Math.floor (Math.random () *256), var b = Math.floor (Math.random () *256); return "RGB (" +r+ "," +g+ "," +b+ ")";} Gets the hexadecimal color function randomColor1 () {var r = Math.floor (Math.random () *256), var g = Math.floor (Math.random () *256), var b = Math.floor (Math.random () *256), if (R <) {r = "0" +r.tostring (16);} Else{r = r.tostring (16);} if (g <) {G = "0" +g.tostring (16);} Else{g = g.tostring (16);} if (b < c) {B = "0" +b.tostring (16);} Else{b = b.tostring (16);} Return "#" +R+G+B;} /* Conversion number.tostring (2); Convert to 2\8\10\16*/function test () {//console.log (new number (). toString (16));} Test ();</script>
JavaScript methods for obtaining random RGB colors and hexadecimal colors