Hi I was playing around with math random the other day and made an RGB color generator and successfully was able to use a text input to limit the roof of the random number, but was unable to get the floor working. Here is the JSFiddle
http://jsfiddle.net/synthet1c/3KR83/
and here is the Javascript function I made
function randomColor(){
var roof = document.getElementById('textRoof').value,
floor = document.getElementById('textFloor').value;
var r = Math.floor((Math.random()*roof)+floor);
var g = Math.floor((Math.random()*roof)+floor);
var b = Math.floor((Math.random()*roof)+floor);
if (r < 10) { var r = "0" + r}
if (r < 100) { var r = "0" + r};
if (g < 10) { var g = "0" + g};
if (g < 100) { var g = "0" + g};
if (b < 10) { var b = "0" + b};
if (b < 100) { var b = "0" + b};
document.getElementById('header').style.color= "rgb("+r+","+g+","+b+")"
document.getElementById('text').value = "rgb("+r+","+g+","+b+")"
}
This is just for the sake of learning it, but any help is appreciated.
Cheers
live example