~~~ function generateRandomAlphaNum(len) { var rdmString = ""; for( ; rdmString.length < len; rdmString += Math.random().toString(36).substr(2)); return rdmString.substr(0, len); } //调用 generateRandomAlphaNum(10);//fa8y393e9a generateRandomAlphaNum(10);//j15mhox8bs ~~~