方法一(随机RGB颜色值)#####
//颜色对象
function getRandomColor(){
this.r = Math.floor(Math.random()*255);
this.g = Math.floor(Math.random()*255);
this.b = Math.floor(Math.random()*255);
this.color = 'rgba('+ this.r +','+ this.g +','+ this.b +',0.8)';
}
方法二 (生成十六进制的颜色值)
var getRandomColor = function(){    
    return  '#' + (function(color){    
         return (color +=  '0123456789abcdef'[Math.floor(Math.random()*16)])    
         && (color.length == 6) ?  color : arguments.callee(color);    
    })('');    
 }方法三
function getRandomColor(){
        return '#'+Math.floor(Math.random()*256).toString(10);
    }方法四
function getRandomColor(){
        return '#'+Math.floor(Math.random()*0xffffff).toString(16);
    }方法五
function getRandomColor(){
      return  '#'+Math.random().toString(16).slice(2,8)
  }









