1个回答
展开全部
这边用js写了一个,看贺空看是不明轮是你要的
<html>
<body>
<script type="text/javascript">
function disp_alert()
{
var howmany=document.getElementById("howmany").value
var topvalue=document.getElementById("topvalue").value
var arr = new Array(howmany)
var i=0,len=howmany;
for (; i<len; )
{
arr[i] = topvalue*Math.random()
i++;
}
var x;
var txt="";
for (x in arr)
{
txt=txt + arr[x]+"<br>";
}
document.getElementById("demo").innerHTML=txt;
}
</script>
</head>
<禅槐瞎body>
<p id="demo"></p>
K <input type=text id=topvalue>
N <input type=text id=howmany>
<input type="button" onclick="disp_alert()" value="生成随机数" />
</body>
</html>
<html>
<body>
<script type="text/javascript">
function disp_alert()
{
var howmany=document.getElementById("howmany").value
var topvalue=document.getElementById("topvalue").value
var arr = new Array(howmany)
var i=0,len=howmany;
for (; i<len; )
{
arr[i] = topvalue*Math.random()
i++;
}
var x;
var txt="";
for (x in arr)
{
txt=txt + arr[x]+"<br>";
}
document.getElementById("demo").innerHTML=txt;
}
</script>
</head>
<禅槐瞎body>
<p id="demo"></p>
K <input type=text id=topvalue>
N <input type=text id=howmany>
<input type="button" onclick="disp_alert()" value="生成随机数" />
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询