// 生成唯一编码
function createRandomId() {
return (Math.random() * 10000000).toString(16).substr(0, 4) + '_' + (new Date()).getTime() + '_' + Math.random().toString().substr(2, 5);
}
//介于 1 到 10 之间的一个随机数:
Math.floor((Math.random()*10)+1);
// 介于 1 到 100 之间的一个随机数:
Math.floor((Math.random()*100)+1);