js生成随机数
来源:互联网 发布:韩春雨 专业评价 知乎 编辑:程序博客网 时间:2024/04/30 00:09
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JS随机数测试</title>
</head>
<body>
<script>
document.write(Math.random());//生成一个0~1之间的很多位数的随机小数
</script>
<br>
<script>
document.write(Math.round(Math.random()*9+1));//生成一个1~10(包括1和10)的随机整数
</script>
<br>
<script>
document.write(Math.round(Math.random()*99+1));//生成一个1~100(包括1和100)的随机整数
</script>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JS随机数测试</title>
</head>
<body>
<script>
document.write(Math.random());//生成一个0~1之间的很多位数的随机小数
</script>
<br>
<script>
document.write(Math.round(Math.random()*9+1));//生成一个1~10(包括1和10)的随机整数
</script>
<br>
<script>
document.write(Math.round(Math.random()*99+1));//生成一个1~100(包括1和100)的随机整数
</script>
</body>
</html>
1 0
- js生成随机数
- js生成随机数
- js生成随机数
- js 生成随机数
- JS 生成随机数
- js 生成随机数
- JS生成随机数
- js生成随机数
- js生成随机数
- js生成随机数
- js 生成随机数方法
- js 生成随机数
- js生成随机数
- JS生成随机数
- js生成随机数
- js生成随机数
- js生成随机数
- js生成随机数
- iframe 高度自适应 手机端适用
- 乐助手电脑版 v3.0.4.33284 官方版
- MySQL去重计数--经过测试的语句
- nginx超级详细配置
- 基于Android源码编译系统应用
- js生成随机数
- 太平洋产险 开启微信服务时代
- C++要点精简总结
- SpannableString来设置超链接、颜色、字体等属性--具体到文字中的某个文字
- 初学者
- java.util.Queue用法
- Leetcode 151题 Reverse Words in a String
- coder之路
- jackson 解析json含有不规则的属性的json字符串的方法