RGB生成随机颜色
function createColor() {
var r = Math.floor(Math.random() * 255);
var g = Math.floor(Math.random() * 255);
var b = Math.floor(Math.random() * 255);
return "rgb(" + r + "," + g + "," + b + ")";
}
生成十六进制的颜色值 #000000
function createColor2() {
return "#" + function (color) {
return new Array(7 - color.length).join("0") + color;//不够六位则在前面补0
}((Math.random() * 0x1000000 << 0).toString(16));
}