<script>
function $(obj){return document.getElementById(obj)}
var n , _startNum , _endNum ,currIndex, numArr
function randomNum( )
{
var t= new Date()
var ms = t.getMilliseconds()
var s = t.getSeconds()
var m = t.getMinutes()
var h = t.getHours()
var luck = parseInt( $("luckNum").value,10)
var bm = parseInt( $("mm").value,10)
var bd = parseInt( $("dd").value,10)
var delayRondom = h + m + s + ms - Math.ceil( (ms/4)*3 )
var randomNum =( ms + s + luck + bm + bd ) % (_endNum + (ms%2) )
var isExist=false
for(var i=0i<numArr.length i++)
中禅 if( numArr[i] == randomNum )isExist=true
if( !$("reNum").checked )
{
if( isExist==false &&randomNum >= _startNum)
{
numArr.push( randomNum )
}
else
{
setTimeout( "randomNum()" , delayRondom )
return
}
}
var span = document.createElement("span")
span.innerHTML= "第"+ currIndex + "个号码:" + randomNum + "<br>"
$("showNum").appendChild(span)
if( currIndex <n )
{
setTimeout( "randomNum()" , delayRondom )
currIndex ++
}
带局 }
function makeNum()
{
var strN = $("numCount").value
var strStartNum = $("startNum").value
var strEndNum = $("endNum").value
$("showNum").innerText=""
currIndex=1
numArr = new Array()
if( !isNaN( strN + strStartNum + strEndNum ) )
{
n = parseInt(strN,10)
_startNum = parseInt(strStartNum,10)
_endNum = parseInt(strEndNum,10)
if( (_endNum - _startNum)>n )
randomNum()
else alert("设置错误!范围必须蠢培让大于生成个数!")
}
else alert("请设置正确的范围和生成个数!")
}
function initSelect(sel, _begin, _end)
{
for(var i=_begini<=_endi++)
{
sel.options.add( new Option( i , i) )
}
}
window.onload=function( )
{
initSelect( $("luckNum") ,0,100)
initSelect( $("mm") ,1,12)
initSelect( $("dd") ,1,31)
}
</script>
<body>
<h1>彩码生成程序</h1>
<div id=showNum ></div>
<br>
<input type=checkbox id=reNum >重复码(打钩是可重复码)
<br>
你需要:<input id=numCount value="7" >个码
<br>
范围从:<input id="startNum" value="0" >至
<input id="endNum" value="36" >小于1000
<br>
请输入你的生日:<select id=mm ></select>月
<select id=dd ></select>日
<br>
请输入你的幸运数字:<select id=luckNum ></select>
<br>
<input type=button value ="生成彩票码" onclick="makeNum()">
</body>
</html>
按照题目要求燃悔中编写的Python程前唤序如下
import random
numlist=random.sample(range(0,10),5)
while numlist[0]==0:
numlist=random.sample(range(0,10),5)
num=int(''.join([str(i) for i in numlist]))
inputnum=int(input("输皮山入号:"))
bonus=0
count=0
if inputnum==num:
bonus=10000
else:
for i in set(str(inputnum)):
if int(i) in numlist:
count+=1
bonus=1000*count
print("彩票号:%d" % num)
print("奖金:%d元" % bonus)
源代码(注意源代码的缩进)
现在市面上有asp,php,java多种语言的源码,具体选择那种看罩者你游灶自己的需求,比如口碑比较好的领航彩票源码他们有asp和java的,一般这些卖源码的都会提供搭建服务,你需要物磨薯准备服务器,域名和支付接口后面搭建网站的事情找卖源码的就好!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)