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;
}
时间: 2024-10-03 21:41:18