彩票程序(要全部是html或htm的)

彩票程序(要全部是html或htm的),第1张

<html>

<script>

function $(obj){return documentgetElementById(obj);}

var n , _startNum , _endNum ,currIndex, numArr ;

function randomNum( )

{

var t= new Date();

var ms = tgetMilliseconds();

var s = tgetSeconds();

var m = tgetMinutes();

var h = tgetHours();

var luck = parseInt( $("luckNum")value,10) ;

var bm = parseInt( $("mm")value,10) ;

var bd = parseInt( $("dd")value,10) ;

var delayRondom = h + m + s + ms - Mathceil( (ms/4)3 );

var randomNum =( ms + s + luck + bm + bd ) % (_endNum + (ms%2) );

var isExist=false;

for(var i=0; i<numArrlength ; i++)

if( numArr[i] == randomNum )isExist=true;

if( !$("reNum")checked )

{

if( isExist==false && randomNum >= _startNum )

{

numArrpush( randomNum );

}

else

{

setTimeout( "randomNum()" , delayRondom );

return ;

}

}

var span = documentcreateElement("span");

spaninnerHTML= "第"+ 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=_begin; i<=_end; i++)

{

seloptionsadd( new Option( i , i) );

}

}

windowonload=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>

我写给你,如果是本专业,以后要多多学习。JDK 16

import javaawtGridLayout;

import javaawteventMouseEvent;

import javaawteventMouseListener;

import javautilIterator;

import javautilRandom;

import javautilSet;

import javautilTreeSet;

import javaxswingJButton;

import javaxswingJFrame;

import javaxswingJTextField;

public class LuckyDrawn {

private JFrame f = new JFrame("Lucky Drawn");

private JButton btn = new JButton("Drawn");

private JTextField result = new JTextField("Result");

private static final int MIN = 1;

private static final int MAX = 30;

private static final int RESULT_COUNT = 7;

public LuckyDrawn(){

fadd(btn);

fadd(result);

resultsetEditable(false);

btnaddMouseListener(new MouseListener(){

public void mouseClicked(MouseEvent e) {

Random rand = new Random();

Set<Integer> set = new TreeSet<Integer>();

while(setsize() < RESULT_COUNT){

setadd(new Integer(randnextInt(MAX)+ 1));

}

StringBuffer sb = new StringBuffer("Lucky numbers are: ");

for (Iterator iter = setiterator(); iterhasNext();) {

sbappend(((Integer) iternext())intValue())append(", ");

}

resultsetText(sbsubstring(0, sblength() - 2)toString());

fpack();

}

public void mouseEntered(MouseEvent e) {}

public void mouseExited(MouseEvent e) {}

public void mousePressed(MouseEvent e) {}

public void mouseReleased(MouseEvent e) {}

});

fsetLayout(new GridLayout(2, 1));

fsetVisible(true);

fsetLocation(500, 200);

fpack();

fvalidate();

fsetDefaultCloseOperation(JFrameEXIT_ON_CLOSE);

}

public static void main(String[] args) {

new LuckyDrawn();

}

}

把下面的代码复制到记事本中,改名为form1frm,再用vb6打开编译即可使用。希望你能喜欢,不足之处可以提出来。

VERSION 500

Begin VBForm Form1

BorderStyle = 5 'Sizable ToolWindow

Caption = "**选号程序"

ClientHeight = 3855

ClientLeft = 60

ClientTop = 330

ClientWidth = 6600

LinkTopic = "Form1"

MaxButton = 0 'False

MinButton = 0 'False

ScaleHeight = 3855

ScaleWidth = 6600

ShowInTaskbar = 0 'False

StartUpPosition = 3 '窗口缺省

Begin VBFrame Frame4

Caption = "号码框"

Height = 2415

Left = 3600

TabIndex = 11

Top = 1320

Width = 2895

Begin VBCommandButton Command6

Caption = "输入号码"

Height = 255

Left = 1560

TabIndex = 19

Top = 720

Width = 1095

End

Begin VBCommandButton Command5

Caption = "试试运气"

Height = 495

Left = 120

TabIndex = 16

Top = 1440

Width = 2535

End

Begin VBTextBox xx

Height = 270

Left = 1560

TabIndex = 14

Top = 1080

Width = 1095

End

Begin VBTextBox sx

Height = 270

Left = 120

TabIndex = 13

Top = 1080

Width = 1095

End

Begin VBLabel Label5

Caption = "范围:"

Height = 255

Left = 120

TabIndex = 18

Top = 720

Width = 615

End

Begin VBLabel Label4

Caption = "机选号码:"

Height = 255

Left = 120

TabIndex = 17

Top = 2040

Width = 2535

End

Begin VBLabel Label3

Caption = "~"

BeginProperty Font

Name = "宋体"

Size = 1425

Charset = 134

Weight = 400

Underline = 0 'False

Italic = 0 'False

Strikethrough = 0 'False

EndProperty

Height = 135

Left = 1320

TabIndex = 15

Top = 1200

Width = 255

End

Begin VBLabel Label2

Caption = "我的号码:"

Height = 255

Left = 120

TabIndex = 12

Top = 360

Width = 2655

End

End

Begin VBFrame Frame3

Caption = "统计框"

Height = 975

Left = 3600

TabIndex = 8

Top = 240

Width = 2895

Begin VBCommandButton Command3

Caption = "点我统计!"

Height = 615

Left = 120

TabIndex = 9

Top = 240

Width = 2655

End

End

Begin VBFrame Frame2

Caption = "查找框"

Height = 2415

Left = 120

TabIndex = 3

Top = 1320

Width = 3375

Begin VBCommandButton Command4

Caption = "清除"

Height = 255

Left = 2400

TabIndex = 10

Top = 2040

Width = 855

End

Begin VBCommandButton Command2

Caption = "查找"

Height = 255

Left = 2520

TabIndex = 7

Top = 240

Width = 735

End

Begin VBListBox List1

Height = 1320

ItemData = "Form1frx":0000

Left = 120

List = "Form1frx":0002

TabIndex = 5

Top = 600

Width = 3135

End

Begin VBTextBox Text1

Height = 270

Left = 120

TabIndex = 4

Top = 240

Width = 2295

End

Begin VBLabel Label1

Caption = "总共:0项"

Height = 255

Left = 120

TabIndex = 6

Top = 2040

Width = 2175

End

End

Begin VBFrame Frame1

Caption = "输入框"

Height = 1095

Left = 120

TabIndex = 0

Top = 120

Width = 3375

Begin VBTextBox Text2

Height = 270

Left = 120

TabIndex = 2

Top = 240

Width = 3135

End

Begin VBCommandButton Command1

Caption = "输入并确定"

Height = 375

Left = 120

TabIndex = 1

Top = 600

Width = 3135

End

End

End

Attribute VB_Name = "Form1"

Attribute VB_GlobalNameSpace = False

Attribute VB_Creatable = False

Attribute VB_PredeclaredId = True

Attribute VB_Exposed = False

Dim N As Long

Dim NR As String

Dim ZS As Long

Dim CS As Long

Dim mynum As Long

Private Sub Command1_Click()

Open "C:\1TXT" For Append As #1

Print #1, Val(Text2Text)

Close #1

Label2Caption = "我的号码:" & Val(Text2Text)

mynum = Val(Text2Text)

Text2Text = ""

End Sub

Private Sub Command2_Click()

CS = CS + 1

Open "C:\1TXT" For Input As #1

Do While Not EOF(1)

Line Input #1, NR

NR = Trim(NR)

If NR = Text1Text Then List1AddItem NR: N = N + 1

Loop

Close #1

List1AddItem "------------第" & CS & "次------------"

Label1Caption = "总共:" & N & "项"

N = 0

NR = ""

End Sub

Private Sub Command3_Click()

Open "C:\1TXT" For Input As #1

Do While Not EOF(1)

Line Input #1, NR

NR = Trim(NR)

If NR = NR Then ZS = ZS + 1

Loop

Close #1

MsgBox "共有" & ZS & "项"

ZS = 0

End Sub

Private Sub Command4_Click()

List1Clear

End Sub

Private Sub Command5_Click()

Label4Caption = "机选号码:" & Int(Rnd Val(sxText)) + Val(xxText)

End Sub

Private Sub Command6_Click()

mynum = InputBox("输入号码:")

Label2Caption = "我的号码:" & mynum

End Sub

Private Sub Form_Load()

N = 0

End Sub

以上就是关于彩票程序(要全部是html或htm的)全部的内容,包括:彩票程序(要全部是html或htm的)、用java编写一个彩票抽奖程序、用VB写个彩票选号程序,求思路!等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/9772798.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-01
下一篇 2023-05-01

发表评论

登录后才能评论

评论列表(0条)

保存