Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

generate random color array javascript

var rgb = [];

for(var i = 0; i < 3; i++)
    rgb.push(Math.floor(Math.random() * 255));

myDiv.style.backgroundColor = 'rgb('+ rgb.join(',') +')';
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #generate #random #color #array #javascript
ADD COMMENT
Topic
Name
8+9 =