function generateId(length) {
length = length || 10;
var letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
var s = '';
for (var i = 0; i < length; i++) {
s += letters.charAt(Math.floor(Math.random() * letters.length));
}
return s;
}
本文出自 “一代宗师” 博客,请务必保留此出处http://765682.blog.51cto.com/755682/1899578