首页 > Web开发 > 详细

JS 随机数

时间:2015-12-16 02:14:44      阅读:232      评论:0      收藏:0      [点我收藏+]
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>随机数</title>
</head>
<body>
<script type="text/javascript">
function Randnum(value){
    var s=1000;
    var d=500;
    if(value==‘b‘){
        document.write(s+parseInt(500*Math.random())); 
    }else{
        document.write(d+parseInt(500*Math.random())); 
    }
}
</script>

<script>Randnum();</script>
</body>
</html>

?

效果图:
bubuko.com,布布扣
?

?

JS 随机数

原文:http://onestopweb.iteye.com/blog/2264138

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!