`
shylhd
  • 浏览: 74261 次
  • 性别: Icon_minigender_2
  • 来自: 河北
最近访客 更多访客>>
社区版块
存档分类
最新评论

生成7位随机数字的js

阅读更多

<script>
var str="qwertyuiopasdfghjklmnbvcxz1234567890"
function getRandomNum(lbound, ubound) {
return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}
var s=str.split("");
var t="";
for (var i=0;i<7;i++){
t+=s[getRandomNum(1,36)];
}
alert(t)
</script>

分享到:
评论
1 楼 tiaccp 2011-01-14  
看不太懂啊

相关推荐

Global site tag (gtag.js) - Google Analytics