随机颜色的二种写法
写法一:
var arr = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "A", "B","C","D"];
      function Color(){
          var str = "#";
          for(var i=0;i<6;i++){
              str += arr[Math.floor(Math.random()*arr.length)]
          }
          return str;
      }
      
写法二:
     function Color() {
            var r = Math.floor(Math.random()*256),
                g = Math.floor(Math.random()*256),
                b = Math.floor(Math.random()*256);
            return "rgb("+r+","+g+","+b+")";
      }
原文:http://www.cnblogs.com/Mr-Welson/p/7553413.html