28,391
社区成员
发帖
与我相关
我的任务
分享
<%@ Language=VBScript %>
<input><input><input><input><input><input><br>
<input><input><input><input><input><input>
<%
dim arr, rtn(12), i,v
arr=Array(10,10,10,10,10,20,20,20,30,30,30,50)
v=0
i=cint(rnd()*11)
while v<ubound(rtn)
if arr(i)<>0 then rtn(v)=arr(i):arr(i)=0:v=v+1
i=cint(rnd()*11)
wend
%>
<script>
var obj=document.getElementsByTagName("input");
<%for i=0 to ubound(rtn)-1%>
obj["<%=i%>"].value="<%=rtn(i)%>";
<%next%>
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<style type="text/css">
.txt{
width:30px;
}
</style>
</head>
<body>
<div id="container">
<input type="text" class="txt" />
<input type="text" class="txt" />
<input type="text" class="txt" />
<input type="text" class="txt" />
<input type="text" class="txt" />
<input type="text" class="txt" />
<input type="text" class="txt" />
<input type="text" class="txt" />
<input type="text" class="txt" />
<input type="text" class="txt" />
<input type="text" class="txt" />
<input type="text" class="txt" />
</div>
<input type="button" value="show" onclick="show();"/>
<script type="text/javascript">
var show=function(){
var inputs = document.getElementById("container").getElementsByTagName("input");
var number = [10,10,10,10,10,20,20,20,30,30,30,50];
number.sort(function(){ return 0.5 - Math.random(); });
for(var i=0;i<inputs.length;i++){
inputs[i].value = number[i];
}
}
</script>
</body>
</html>